1 // Copyright (C) 2007-2019 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 * BLSURFPlugin_Hypothesis_i::GetMeshGemsVersion
75 * Get version of MeshGems suite.
77 //=============================================================================
78 char* BLSURFPlugin_Hypothesis_i::GetMeshGemsVersion()
80 return CORBA::string_dup( this->GetImpl()->GetMeshGemsVersion().c_str() );
83 //=============================================================================
85 * BLSURFPlugin_Hypothesis_i::SetPhysicalMesh
89 //=============================================================================
90 void BLSURFPlugin_Hypothesis_i::SetPhysicalMesh(CORBA::Long theValue)
93 this->GetImpl()->SetPhysicalMesh((::BLSURFPlugin_Hypothesis::PhysicalMesh) theValue);
94 SMESH::TPythonDump() << _this() << ".SetPhysicalMesh( " << theValue << " )";
97 //=============================================================================
99 * BLSURFPlugin_Hypothesis_i::GetPhysicalMesh
103 //=============================================================================
104 CORBA::Long BLSURFPlugin_Hypothesis_i::GetPhysicalMesh()
107 return this->GetImpl()->GetPhysicalMesh();
110 //=============================================================================
112 * BLSURFPlugin_Hypothesis_i::SetGeometricMesh
117 //=============================================================================
118 void BLSURFPlugin_Hypothesis_i::SetGeometricMesh(CORBA::Long theValue)
121 this->GetImpl()->SetGeometricMesh((::BLSURFPlugin_Hypothesis::GeometricMesh) theValue);
122 SMESH::TPythonDump() << _this() << ".SetGeometricMesh( " << theValue << " )";
125 //=============================================================================
127 * BLSURFPlugin_Hypothesis_i::GetGeometricMesh
131 //=============================================================================
132 CORBA::Long BLSURFPlugin_Hypothesis_i::GetGeometricMesh()
135 return this->GetImpl()->GetGeometricMesh();
138 //=============================================================================
140 * BLSURFPlugin_Hypothesis_i::SetPhySize
144 //=============================================================================
145 void BLSURFPlugin_Hypothesis_i::SetPhySize(CORBA::Double theValue)
148 this->GetImpl()->SetPhySize(theValue, false);
149 SMESH::TPythonDump() << _this() << ".SetPhySize( " << theValue << " )";
152 //=============================================================================
154 * BLSURFPlugin_Hypothesis_i::SetPhySizeRel
156 * Set Relative PhySize
158 //=============================================================================
159 void BLSURFPlugin_Hypothesis_i::SetPhySizeRel(CORBA::Double theValue)
162 this->GetImpl()->SetPhySize(theValue, true);
163 SMESH::TPythonDump() << _this() << ".SetPhySizeRel( " << theValue << " )";
166 //=============================================================================
168 * BLSURFPlugin_Hypothesis_i::GetPhySize
172 //=============================================================================
173 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhySize()
176 return this->GetImpl()->GetPhySize();
179 //=============================================================================
181 * BLSURFPlugin_Hypothesis_i::IsPhySizeRel
183 * Returns True if PhySize is relative
185 //=============================================================================
186 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsPhySizeRel()
189 return this->GetImpl()->IsPhySizeRel();
192 //=============================================================================
193 void BLSURFPlugin_Hypothesis_i::SetMinSize(CORBA::Double theMinSize)
195 if (IsMinSizeRel() || GetMinSize() != theMinSize ) {
196 this->GetImpl()->SetMinSize(theMinSize, false);
197 SMESH::TPythonDump() << _this() << ".SetMinSize( " << theMinSize << " )";
201 //=============================================================================
202 void BLSURFPlugin_Hypothesis_i::SetMinSizeRel(CORBA::Double theMinSize)
204 if ( !IsMinSizeRel() || (GetMinSize() != theMinSize) ) {
205 this->GetImpl()->SetMinSize(theMinSize, true);
206 SMESH::TPythonDump() << _this() << ".SetMinSizeRel( " << theMinSize << " )";
210 //=============================================================================
211 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMinSize()
213 return this->GetImpl()->GetMinSize();
216 //=============================================================================
217 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMinSizeRel()
219 return this->GetImpl()->IsMinSizeRel();
222 //=============================================================================
223 void BLSURFPlugin_Hypothesis_i::SetMaxSize(CORBA::Double theMaxSize)
225 if (IsMaxSizeRel() || GetMaxSize() != theMaxSize) {
226 this->GetImpl()->SetMaxSize(theMaxSize, false);
227 SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theMaxSize << " )";
231 //=============================================================================
232 void BLSURFPlugin_Hypothesis_i::SetMaxSizeRel(CORBA::Double theMaxSize)
234 if ( !IsMaxSizeRel() || (GetMaxSize() != theMaxSize) ) {
235 this->GetImpl()->SetMaxSize(theMaxSize, true);
236 SMESH::TPythonDump() << _this() << ".SetMaxSizeRel( " << theMaxSize << " )";
240 //=============================================================================
241 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMaxSize()
243 return this->GetImpl()->GetMaxSize();
246 //=============================================================================
247 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMaxSizeRel()
249 return this->GetImpl()->IsMaxSizeRel();
253 //=============================================================================
255 * BLSURFPlugin_Hypothesis_i::SetUseGradation
259 //=============================================================================
260 void BLSURFPlugin_Hypothesis_i::SetUseGradation(CORBA::Boolean theValue)
262 if ( GetImpl()->GetUseGradation() != bool( theValue ))
264 this->GetImpl()->SetUseGradation(theValue);
265 std::string theValueStr = theValue ? "True" : "False";
266 SMESH::TPythonDump() << _this() << ".SetUseGradation( " << theValueStr.c_str() << " )";
270 //=============================================================================
272 * BLSURFPlugin_Hypothesis_i::GetUseGradation
276 //=============================================================================
277 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseGradation()
279 return this->GetImpl()->GetUseGradation();
282 //=============================================================================
284 * BLSURFPlugin_Hypothesis_i::SetGradation
288 //=============================================================================
289 void BLSURFPlugin_Hypothesis_i::SetGradation(CORBA::Double theValue)
291 this->GetImpl()->SetGradation(theValue);
294 SetUseGradation( false );
296 SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )";
299 //=============================================================================
301 * BLSURFPlugin_Hypothesis_i::GetGradation
305 //=============================================================================
306 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation()
308 return this->GetImpl()->GetGradation();
311 //=============================================================================
313 * BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation
317 //=============================================================================
318 void BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation(CORBA::Boolean theValue)
320 if ( GetImpl()->GetUseVolumeGradation() != bool( theValue ))
322 this->GetImpl()->SetUseVolumeGradation(theValue);
323 std::string theValueStr = theValue ? "True" : "False";
324 SMESH::TPythonDump() << _this() << ".SetUseVolumeGradation( " << theValueStr.c_str() << " )";
328 //=============================================================================
330 * BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation
334 //=============================================================================
335 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation()
337 return this->GetImpl()->GetUseVolumeGradation();
340 //=============================================================================
342 * BLSURFPlugin_Hypothesis_i::SetVolumeGradation
344 * Set VolumeGradation
346 //=============================================================================
347 void BLSURFPlugin_Hypothesis_i::SetVolumeGradation(CORBA::Double theValue)
349 this->GetImpl()->SetVolumeGradation(theValue);
351 SetUseVolumeGradation( false );
353 SMESH::TPythonDump() << _this() << ".SetVolumeGradation( " << theValue << " )";
356 //=============================================================================
358 * BLSURFPlugin_Hypothesis_i::GetVolumeGradation
360 * Get VolumeGradation
362 //=============================================================================
363 CORBA::Double BLSURFPlugin_Hypothesis_i::GetVolumeGradation()
365 return this->GetImpl()->GetVolumeGradation();
368 //=============================================================================
370 * BLSURFPlugin_Hypothesis_i::SetQuadAllowed
374 * DEPRACATED, kept for python script compatibility
376 * TO be removed in Salome 9
378 //=============================================================================
379 void BLSURFPlugin_Hypothesis_i::SetQuadAllowed(CORBA::Boolean theValue)
381 ::BLSURFPlugin_Hypothesis::ElementType theElementType = theValue ?
382 ::BLSURFPlugin_Hypothesis::QuadrangleDominant : ::BLSURFPlugin_Hypothesis::Triangles;
383 this->GetImpl()->SetElementType(theElementType);
384 SMESH::TPythonDump() << _this() << ".SetElementType( " << theElementType << " )";
387 //=============================================================================
389 * BLSURFPlugin_Hypothesis_i::SetElementType
393 //=============================================================================
394 void BLSURFPlugin_Hypothesis_i::SetElementType(CORBA::Long theValue)
396 this->GetImpl()->SetElementType((::BLSURFPlugin_Hypothesis::ElementType) theValue);
397 SMESH::TPythonDump() << _this() << ".SetElementType( " << theValue << " )";
399 //=============================================================================
401 * BLSURFPlugin_Hypothesis_i::GetElementType
405 //=============================================================================
406 CORBA::Long BLSURFPlugin_Hypothesis_i::GetElementType()
408 return this->GetImpl()->GetElementType();
411 //=============================================================================
413 * BLSURFPlugin_Hypothesis_i::SetAngleMesh
417 //=============================================================================
418 void BLSURFPlugin_Hypothesis_i::SetAngleMesh(CORBA::Double theValue)
420 this->GetImpl()->SetAngleMesh(theValue);
421 SMESH::TPythonDump() << _this() << ".SetAngleMesh( " << theValue << " )";
424 //=============================================================================
426 * BLSURFPlugin_Hypothesis_i::GetAngleMesh
430 //=============================================================================
431 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMesh()
433 return this->GetImpl()->GetAngleMesh();
436 //=============================================================================
438 * BLSURFPlugin_Hypothesis_i::SetChordalError
442 //=============================================================================
443 void BLSURFPlugin_Hypothesis_i::SetChordalError(CORBA::Double theValue)
445 this->GetImpl()->SetChordalError(theValue);
446 SMESH::TPythonDump() << _this() << ".SetChordalError( " << theValue << " )";
449 //=============================================================================
451 * BLSURFPlugin_Hypothesis_i::GetChordalError
455 //=============================================================================
456 CORBA::Double BLSURFPlugin_Hypothesis_i::GetChordalError()
458 return this->GetImpl()->GetChordalError();
461 //=============================================================================
463 * BLSURFPlugin_Hypothesis_i::SetAnisotropic
467 //=============================================================================
468 void BLSURFPlugin_Hypothesis_i::SetAnisotropic(CORBA::Boolean theValue)
470 this->GetImpl()->SetAnisotropic(theValue);
471 std::string theValueStr = theValue ? "True" : "False";
472 SMESH::TPythonDump() << _this() << ".SetAnisotropic( " << theValueStr.c_str() << " )";
475 //=============================================================================
477 * BLSURFPlugin_Hypothesis_i::GetAnisotropic
481 //=============================================================================
482 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetAnisotropic()
484 return this->GetImpl()->GetAnisotropic();
487 //=============================================================================
489 * BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio
491 * Set Anisotropic Ratio
493 //=============================================================================
494 void BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio(CORBA::Double theValue)
496 this->GetImpl()->SetAnisotropicRatio(theValue);
497 SMESH::TPythonDump() << _this() << ".SetAnisotropicRatio( " << theValue << " )";
500 //=============================================================================
502 * BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio
504 * Get Anisotropic Ratio
506 //=============================================================================
507 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio()
509 return this->GetImpl()->GetAnisotropicRatio();
513 //=============================================================================
515 * BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges
519 //=============================================================================
520 void BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges(CORBA::Boolean theValue) {
522 this->GetImpl()->SetRemoveTinyEdges(theValue);
523 std::string theValueStr = theValue ? "True" : "False";
524 SMESH::TPythonDump() << _this() << ".SetRemoveTinyEdges( " << theValueStr.c_str() << " )";
527 //=============================================================================
529 * BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges
533 //=============================================================================
534 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges() {
536 return this->GetImpl()->GetRemoveTinyEdges();
539 //=============================================================================
541 * BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength
543 * Set Tiny Edge Length
545 //=============================================================================
546 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength(CORBA::Double theValue) {
548 this->GetImpl()->SetTinyEdgeLength(theValue);
549 SMESH::TPythonDump() << _this() << ".SetTinyEdgeLength( " << theValue << " )";
552 //=============================================================================
554 * BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength
556 * Get Tiny Edge Length
558 //=============================================================================
559 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength() {
561 return this->GetImpl()->GetTinyEdgeLength();
564 //=============================================================================
566 * BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges
570 //=============================================================================
571 void BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges(CORBA::Boolean theValue) {
573 this->GetImpl()->SetOptimiseTinyEdges(theValue);
574 std::string theValueStr = theValue ? "True" : "False";
575 SMESH::TPythonDump() << _this() << ".SetOptimiseTinyEdges( " << theValueStr.c_str() << " )";
578 //=============================================================================
580 * BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges
584 //=============================================================================
585 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges() {
587 return this->GetImpl()->GetOptimiseTinyEdges();
590 //=============================================================================
592 * BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength
594 * Set Tiny Edge OptimisationLength
596 //=============================================================================
597 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength(CORBA::Double theValue) {
599 this->GetImpl()->SetTinyEdgeOptimisationLength(theValue);
600 SMESH::TPythonDump() << _this() << ".SetTinyEdgeOptimisationLength( " << theValue << " )";
603 //=============================================================================
605 * BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength
607 * Get Tiny Edge OptimisationLength
609 //=============================================================================
610 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength() {
612 return this->GetImpl()->GetTinyEdgeOptimisationLength();
615 //=============================================================================
617 * BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection
621 //=============================================================================
622 void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection(CORBA::Boolean theValue) {
624 this->GetImpl()->SetCorrectSurfaceIntersection(theValue);
625 std::string theValueStr = theValue ? "True" : "False";
626 SMESH::TPythonDump() << _this() << ".SetCorrectSurfaceIntersection( " << theValueStr.c_str() << " )";
629 //=============================================================================
631 * BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection
635 //=============================================================================
636 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection() {
638 return this->GetImpl()->GetCorrectSurfaceIntersection();
641 //=============================================================================
643 * BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost
645 * Set Tiny Edge OptimisationLength
647 //=============================================================================
648 void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost(CORBA::Double theValue) {
650 this->GetImpl()->SetCorrectSurfaceIntersectionMaxCost(theValue);
651 SMESH::TPythonDump() << _this() << ".SetCorrectSurfaceIntersectionMaxCost( " << theValue << " )";
654 //=============================================================================
656 * BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost
658 * Get Tiny Edge OptimisationLength
660 //=============================================================================
661 CORBA::Double BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost() {
663 return this->GetImpl()->GetCorrectSurfaceIntersectionMaxCost();
666 //=============================================================================
668 * BLSURFPlugin_Hypothesis_i::SetBadElementRemoval
672 //=============================================================================
673 void BLSURFPlugin_Hypothesis_i::SetBadElementRemoval(CORBA::Boolean theValue) {
675 this->GetImpl()->SetBadElementRemoval(theValue);
676 std::string theValueStr = theValue ? "True" : "False";
677 SMESH::TPythonDump() << _this() << ".SetBadElementRemoval( " << theValueStr.c_str() << " )";
680 //=============================================================================
682 * BLSURFPlugin_Hypothesis_i::GetBadElementRemoval
686 //=============================================================================
687 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetBadElementRemoval() {
689 return this->GetImpl()->GetBadElementRemoval();
692 //=============================================================================
694 * BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio
696 * Set Bad Surface Element Aspect Ratio
698 //=============================================================================
699 void BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio(CORBA::Double theValue) {
701 this->GetImpl()->SetBadElementAspectRatio(theValue);
702 SMESH::TPythonDump() << _this() << ".SetBadElementAspectRatio( " << theValue << " )";
705 //=============================================================================
707 * BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio
709 * Get Bad Surface Element Aspect Ratio
711 //=============================================================================
712 CORBA::Double BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio() {
714 return this->GetImpl()->GetBadElementAspectRatio();
717 //=============================================================================
719 * BLSURFPlugin_Hypothesis_i::SetOptimizeMesh
723 //=============================================================================
724 void BLSURFPlugin_Hypothesis_i::SetOptimizeMesh(CORBA::Boolean theValue) {
726 this->GetImpl()->SetOptimizeMesh(theValue);
727 std::string theValueStr = theValue ? "True" : "False";
728 SMESH::TPythonDump() << _this() << ".SetOptimizeMesh( " << theValueStr.c_str() << " )";
731 //=============================================================================
733 * BLSURFPlugin_Hypothesis_i::GetOptimizeMesh
737 //=============================================================================
738 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimizeMesh() {
740 return this->GetImpl()->GetOptimizeMesh();
743 //=============================================================================
745 * BLSURFPlugin_Hypothesis_i::SetQuadraticMesh
749 //=============================================================================
750 void BLSURFPlugin_Hypothesis_i::SetQuadraticMesh(CORBA::Boolean theValue) {
752 this->GetImpl()->SetQuadraticMesh(theValue);
753 std::string theValueStr = theValue ? "True" : "False";
754 SMESH::TPythonDump() << _this() << ".SetQuadraticMesh( " << theValueStr.c_str() << " )";
757 //=============================================================================
759 * BLSURFPlugin_Hypothesis_i::GetQuadraticMesh
763 //=============================================================================
764 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadraticMesh() {
766 return this->GetImpl()->GetQuadraticMesh();
774 * BLSURFPlugin_Hypothesis_i::SetTopology
779 //=============================================================================
780 void BLSURFPlugin_Hypothesis_i::SetTopology(CORBA::Long theValue) {
782 this->GetImpl()->SetTopology((::BLSURFPlugin_Hypothesis::Topology) theValue);
783 SMESH::TPythonDump() << _this() << ".SetTopology( " << theValue << " )";
786 //=============================================================================
788 * BLSURFPlugin_Hypothesis_i::GetTopology
792 //=============================================================================
793 CORBA::Long BLSURFPlugin_Hypothesis_i::GetTopology() {
795 return this->GetImpl()->GetTopology();
798 //=============================================================================
800 * Activate/deactivate surface proximity computation
802 void BLSURFPlugin_Hypothesis_i::SetSurfaceProximity( CORBA::Boolean toUse )
804 if ( GetSurfaceProximity() != toUse )
806 this->GetImpl()->SetUseSurfaceProximity( toUse );
807 SMESH::TPythonDump() << _this() << ".SetSurfaceProximity( " << toUse << " )";
811 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetSurfaceProximity()
813 return this->GetImpl()->GetUseSurfaceProximity();
816 //=============================================================================
818 * Set number of surface element layers to be generated due to surface proximity
820 void BLSURFPlugin_Hypothesis_i::SetNbSurfaceProximityLayers( CORBA::Short nbLayers )
822 if ( GetNbSurfaceProximityLayers() != nbLayers )
824 this->GetImpl()->SetNbSurfaceProximityLayers( nbLayers );
825 SMESH::TPythonDump() << _this() << ".SetNbSurfaceProximityLayers( " << nbLayers << " )";
829 CORBA::Short BLSURFPlugin_Hypothesis_i::GetNbSurfaceProximityLayers()
831 return this->GetImpl()->GetNbSurfaceProximityLayers();
834 //=============================================================================
836 * Set coefficient by which size of element refined due to surface proximity is increased
838 void BLSURFPlugin_Hypothesis_i::SetSurfaceProximityRatio( CORBA::Double ratio )
840 if ( GetSurfaceProximityRatio() != ratio )
842 this->GetImpl()->SetSurfaceProximityRatio( ratio );
843 SMESH::TPythonDump() << _this() << ".SetSurfaceProximityRatio( " << ratio << " )";
847 CORBA::Double BLSURFPlugin_Hypothesis_i::GetSurfaceProximityRatio()
849 return this->GetImpl()->GetSurfaceProximityRatio();
852 //=============================================================================
854 * Activate/deactivate volume proximity computation
856 void BLSURFPlugin_Hypothesis_i::SetVolumeProximity( CORBA::Boolean toUse )
858 if ( GetVolumeProximity() != toUse )
860 this->GetImpl()->SetUseVolumeProximity( toUse );
861 SMESH::TPythonDump() << _this() << ".SetVolumeProximity( " << toUse << " )";
865 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetVolumeProximity()
867 return this->GetImpl()->GetUseVolumeProximity();
871 //=============================================================================
873 * Set number of surface element layers to be generated due to volume proximity
875 void BLSURFPlugin_Hypothesis_i::SetNbVolumeProximityLayers( CORBA::Short nbLayers )
877 if ( GetNbVolumeProximityLayers() != nbLayers )
879 this->GetImpl()->SetNbVolumeProximityLayers( nbLayers );
880 SMESH::TPythonDump() << _this() << ".SetNbVolumeProximityLayers( " << nbLayers << " )";
884 CORBA::Short BLSURFPlugin_Hypothesis_i::GetNbVolumeProximityLayers()
886 return this->GetImpl()->GetNbVolumeProximityLayers();
889 //=============================================================================
891 * Set coefficient by which size of element refined due to volume proximity is increased
893 void BLSURFPlugin_Hypothesis_i::SetVolumeProximityRatio( CORBA::Double ratio )
895 if ( GetVolumeProximityRatio() != ratio )
897 this->GetImpl()->SetVolumeProximityRatio( ratio );
898 SMESH::TPythonDump() << _this() << ".SetVolumeProximityRatio( " << ratio << " )";
902 CORBA::Double BLSURFPlugin_Hypothesis_i::GetVolumeProximityRatio()
904 return this->GetImpl()->GetVolumeProximityRatio();
907 //=============================================================================
908 void BLSURFPlugin_Hypothesis_i::SetVerbosity(CORBA::Short theVal) throw (SALOME::SALOME_Exception) {
910 if (theVal < 0 || theVal > 100)
911 THROW_SALOME_CORBA_EXCEPTION( "Invalid verbosity level",SALOME::BAD_PARAM );
912 this->GetImpl()->SetVerbosity(theVal);
913 SMESH::TPythonDump() << _this() << ".SetVerbosity( " << theVal << " )";
916 //=============================================================================
918 CORBA::Short BLSURFPlugin_Hypothesis_i::GetVerbosity() {
920 return (CORBA::Short) this->GetImpl()->GetVerbosity();
923 //=============================================================================
924 void BLSURFPlugin_Hypothesis_i::SetEnforceCadEdgesSize( CORBA::Boolean toEnforce )
926 if ( GetEnforceCadEdgesSize() != toEnforce )
928 this->GetImpl()->SetEnforceCadEdgesSize(toEnforce);
929 SMESH::TPythonDump() << _this() << ".SetEnforceCadEdgesSize( " << toEnforce << " )";
932 //=============================================================================
933 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetEnforceCadEdgesSize()
935 return this->GetImpl()->GetEnforceCadEdgesSize();
937 //=============================================================================
939 void BLSURFPlugin_Hypothesis_i::SetJacobianRectificationRespectGeometry( CORBA::Boolean allowRectification )
941 if ( GetJacobianRectificationRespectGeometry() != allowRectification )
943 this->GetImpl()->SetJacobianRectificationRespectGeometry(allowRectification);
944 SMESH::TPythonDump() << _this() << ".SetJacobianRectificationRespectGeometry( " << allowRectification << " )";
947 //=============================================================================
948 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetJacobianRectificationRespectGeometry()
950 return this->GetImpl()->GetJacobianRectificationRespectGeometry();
952 //=============================================================================
954 void BLSURFPlugin_Hypothesis_i::SetJacobianRectification( CORBA::Boolean allowRectification )
956 if ( GetJacobianRectification() != allowRectification )
958 this->GetImpl()->SetJacobianRectification(allowRectification);
959 SMESH::TPythonDump() << _this() << ".SetJacobianRectification( " << allowRectification << " )";
962 //=============================================================================
963 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetJacobianRectification()
965 return this->GetImpl()->GetJacobianRectification();
967 //=============================================================================
969 void BLSURFPlugin_Hypothesis_i::SetUseDeprecatedPatchMesher( CORBA::Boolean useDeprecatedPatchMesher )
971 if ( GetUseDeprecatedPatchMesher() != useDeprecatedPatchMesher )
973 this->GetImpl()->SetUseDeprecatedPatchMesher(useDeprecatedPatchMesher);
974 SMESH::TPythonDump() << _this() << ".SetUseDeprecatedPatchMesher( " << useDeprecatedPatchMesher << " )";
977 //=============================================================================
978 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseDeprecatedPatchMesher()
980 return this->GetImpl()->GetUseDeprecatedPatchMesher();
982 //=============================================================================
984 void BLSURFPlugin_Hypothesis_i::SetMaxNumberOfPointsPerPatch( CORBA::Long nb ) throw (SALOME::SALOME_Exception)
986 if ( GetMaxNumberOfPointsPerPatch() != nb )
989 this->GetImpl()->SetMaxNumberOfPointsPerPatch(nb);
991 } catch (const std::invalid_argument& ex) {
992 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
993 } catch (SALOME_Exception& ex) {
994 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
996 SMESH::TPythonDump() << _this() << ".SetMaxNumberOfPointsPerPatch( " << nb << " )";
999 //=============================================================================
1000 CORBA::Long BLSURFPlugin_Hypothesis_i::GetMaxNumberOfPointsPerPatch()
1002 return this->GetImpl()->GetMaxNumberOfPointsPerPatch();
1004 //=============================================================================
1006 void BLSURFPlugin_Hypothesis_i::SetMaxNumberOfThreads( CORBA::Long nb ) throw (SALOME::SALOME_Exception)
1008 if ( GetMaxNumberOfThreads() != nb )
1011 this->GetImpl()->SetMaxNumberOfThreads(nb);
1013 } catch (const std::invalid_argument& ex) {
1014 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1015 } catch (SALOME_Exception& ex) {
1016 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1018 SMESH::TPythonDump() << _this() << ".SetMaxNumberOfThreads( " << nb << " )";
1021 //=============================================================================
1022 CORBA::Long BLSURFPlugin_Hypothesis_i::GetMaxNumberOfThreads()
1024 return this->GetImpl()->GetMaxNumberOfThreads();
1026 //=============================================================================
1028 void BLSURFPlugin_Hypothesis_i::SetRespectGeometry( CORBA::Boolean toRespect )
1030 if ( GetRespectGeometry() != toRespect )
1032 this->GetImpl()->SetRespectGeometry(toRespect);
1033 SMESH::TPythonDump() << _this() << ".SetRespectGeometry( " << toRespect << " )";
1036 //=============================================================================
1037 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRespectGeometry()
1039 return this->GetImpl()->GetRespectGeometry();
1041 //=============================================================================
1043 void BLSURFPlugin_Hypothesis_i::SetTinyEdgesAvoidSurfaceIntersections( CORBA::Boolean toAvoidIntersection )
1045 if ( GetTinyEdgesAvoidSurfaceIntersections() != toAvoidIntersection )
1047 this->GetImpl()->SetTinyEdgesAvoidSurfaceIntersections(toAvoidIntersection);
1048 SMESH::TPythonDump() << _this() << ".SetTinyEdgesAvoidSurfaceIntersections( " << toAvoidIntersection << " )";
1051 //=============================================================================
1052 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetTinyEdgesAvoidSurfaceIntersections()
1054 return this->GetImpl()->GetTinyEdgesAvoidSurfaceIntersections();
1056 //=============================================================================
1058 void BLSURFPlugin_Hypothesis_i::SetClosedGeometry( CORBA::Boolean isClosed )
1060 if ( GetClosedGeometry() != isClosed )
1062 this->GetImpl()->SetClosedGeometry(isClosed);
1063 SMESH::TPythonDump() << _this() << ".SetClosedGeometry( " << isClosed << " )";
1066 //=============================================================================
1067 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetClosedGeometry()
1069 return this->GetImpl()->GetClosedGeometry();
1071 //=============================================================================
1073 void BLSURFPlugin_Hypothesis_i::SetDebug( CORBA::Boolean isDebug )
1075 if ( GetDebug() != isDebug )
1077 this->GetImpl()->SetDebug(isDebug);
1078 SMESH::TPythonDump() << _this() << ".SetDebug( " << isDebug << " )";
1081 //=============================================================================
1082 bool BLSURFPlugin_Hypothesis_i::GetDebug()
1084 return this->GetImpl()->GetDebug();
1086 //=============================================================================
1088 void BLSURFPlugin_Hypothesis_i::SetPeriodicTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception)
1091 if ( GetImpl()->GetPreCADOptionValue("periodic_tolerance",&isDefault) != SMESH_Comment( tol ))
1095 this->GetImpl()->SetPeriodicTolerance(tol);
1097 } catch (const std::invalid_argument& ex) {
1098 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1099 } catch (SALOME_Exception& ex) {
1100 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1102 SMESH::TPythonDump() << _this() << ".SetPeriodicTolerance( " << tol << " )";
1105 //=============================================================================
1106 double BLSURFPlugin_Hypothesis_i::GetPeriodicTolerance() throw (SALOME::SALOME_Exception)
1109 return this->GetImpl()->GetPeriodicTolerance();
1111 } catch (const std::invalid_argument& ex) {
1112 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1113 } catch (SALOME_Exception& ex) {
1114 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1118 //=============================================================================
1120 void BLSURFPlugin_Hypothesis_i::SetRequiredEntities( const char* howToTreat ) throw (SALOME::SALOME_Exception)
1122 if ( GetImpl()->GetRequiredEntities() != howToTreat )
1125 this->GetImpl()->SetRequiredEntities(howToTreat);
1127 } catch (const std::invalid_argument& ex) {
1128 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1129 } catch (SALOME_Exception& ex) {
1130 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1132 SMESH::TPythonDump() << _this() << ".SetRequiredEntities( '" << howToTreat << "' )";
1135 //=============================================================================
1136 char* BLSURFPlugin_Hypothesis_i::GetRequiredEntities()
1138 return CORBA::string_dup( this->GetImpl()->GetRequiredEntities().c_str() );
1140 //=============================================================================
1142 void BLSURFPlugin_Hypothesis_i::SetSewingTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception)
1145 if ( GetImpl()->GetPreCADOptionValue("sewing_tolerance",&isDefault) != SMESH_Comment( tol ))
1149 this->GetImpl()->SetSewingTolerance(tol);
1150 SMESH::TPythonDump() << _this() << ".SetSewingTolerance( " << tol << " )";
1152 } catch (const std::invalid_argument& ex) {
1153 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1154 } catch (SALOME_Exception& ex) {
1155 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1159 //=============================================================================
1160 CORBA::Double BLSURFPlugin_Hypothesis_i::GetSewingTolerance() throw (SALOME::SALOME_Exception)
1164 return this->GetImpl()->GetSewingTolerance();
1166 } catch (const std::invalid_argument& ex) {
1167 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1168 } catch (SALOME_Exception& ex) {
1169 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1173 //=============================================================================
1175 void BLSURFPlugin_Hypothesis_i::SetTags( const char* howToTreat ) throw (SALOME::SALOME_Exception)
1177 if ( GetImpl()->GetTags() != howToTreat )
1180 this->GetImpl()->SetTags(howToTreat);
1182 catch (const std::invalid_argument& ex) {
1183 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1184 } catch (SALOME_Exception& ex) {
1185 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1188 SMESH::TPythonDump() << _this() << ".SetTags( '" << howToTreat << "' )";
1190 //=============================================================================
1191 char* BLSURFPlugin_Hypothesis_i::GetTags()
1193 return CORBA::string_dup( this->GetImpl()->GetTags().c_str() );
1196 //=============================================================================
1197 void BLSURFPlugin_Hypothesis_i::SetHyperPatches(const BLSURFPlugin::THyperPatchList& hpl)
1199 ::BLSURFPlugin_Hypothesis::THyperPatchList patchList( hpl.length() );
1200 SMESH_Comment hplDump;
1202 for ( size_t i = 0; i < patchList.size(); ++i )
1205 BLSURFPlugin::THyperPatch tags = hpl[ i ];
1206 for ( CORBA::ULong j = 0; j < tags.length(); ++j )
1208 patchList[ i ].insert( tags[ j ]);
1209 hplDump << tags[ j ] << ( j+1 < tags.length() ? ", " : " ]" );
1211 hplDump << ( i+1 < patchList.size() ? "," : "]");
1213 if ( GetImpl()->GetHyperPatches() != patchList )
1215 GetImpl()->SetHyperPatches( patchList );
1216 SMESH::TPythonDump() << _this() << ".SetHyperPatches( " << hplDump << " )";
1220 //=============================================================================
1221 BLSURFPlugin::THyperPatchList* BLSURFPlugin_Hypothesis_i::GetHyperPatches()
1223 const ::BLSURFPlugin_Hypothesis::THyperPatchList& hpl = GetImpl()->GetHyperPatches();
1224 BLSURFPlugin::THyperPatchList* resHpl = new BLSURFPlugin::THyperPatchList();
1225 resHpl->length( hpl.size() );
1227 ::BLSURFPlugin_Hypothesis::THyperPatchList::const_iterator hpIt = hpl.begin();
1228 for ( int i = 0; hpIt != hpl.end(); ++hpIt, ++i )
1230 const ::BLSURFPlugin_Hypothesis::THyperPatchTags& hp = *hpIt;
1231 BLSURFPlugin::THyperPatch& resHp = (*resHpl)[ i ];
1232 resHp.length( hp.size() );
1234 ::BLSURFPlugin_Hypothesis::THyperPatchTags::const_iterator tag = hp.begin();
1235 for ( int j = 0; tag != hp.end(); ++tag, ++j )
1241 //=============================================================================
1243 * BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges
1247 //=============================================================================
1248 void BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges(CORBA::Boolean theValue) {
1250 this->GetImpl()->SetPreCADMergeEdges(theValue);
1251 std::string theValueStr = theValue ? "True" : "False";
1252 SMESH::TPythonDump() << _this() << ".SetPreCADMergeEdges( " << theValueStr.c_str() << " )";
1255 //=============================================================================
1257 * BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges
1261 //=============================================================================
1262 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges() {
1264 return this->GetImpl()->GetPreCADMergeEdges();
1267 //=============================================================================
1269 * BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces
1273 //=============================================================================
1274 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue) {
1276 this->GetImpl()->SetPreCADRemoveDuplicateCADFaces(theValue);
1277 std::string theValueStr = theValue ? "True" : "False";
1278 SMESH::TPythonDump() << _this() << ".SetPreCADRemoveDuplicateCADFaces( " << theValueStr.c_str() << " )";
1281 //=============================================================================
1283 * BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces
1287 //=============================================================================
1288 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces() {
1290 return this->GetImpl()->GetPreCADRemoveDuplicateCADFaces();
1293 //=============================================================================
1295 * BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology
1299 //=============================================================================
1300 void BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology(CORBA::Boolean theValue) {
1302 this->GetImpl()->SetPreCADProcess3DTopology(theValue);
1303 std::string theValueStr = theValue ? "True" : "False";
1304 SMESH::TPythonDump() << _this() << ".SetPreCADProcess3DTopology( " << theValueStr.c_str() << " )";
1307 //=============================================================================
1309 * BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology
1313 //=============================================================================
1314 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology() {
1316 return this->GetImpl()->GetPreCADProcess3DTopology();
1319 //=============================================================================
1321 * BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput
1325 //=============================================================================
1326 void BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput(CORBA::Boolean theValue) {
1328 this->GetImpl()->SetPreCADDiscardInput(theValue);
1329 std::string theValueStr = theValue ? "True" : "False";
1330 SMESH::TPythonDump() << _this() << ".SetPreCADDiscardInput( " << theValueStr.c_str() << " )";
1333 //=============================================================================
1335 * BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput
1339 //=============================================================================
1340 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput() {
1342 return this->GetImpl()->GetPreCADDiscardInput();
1346 //=============================================================================
1348 void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
1349 throw (SALOME::SALOME_Exception) {
1352 std::string name( optionName );
1353 if ( !optionValue || !optionValue[0] )
1354 UnsetOption( optionName );
1356 // basic options (visible in Advanced table)
1358 else if ( name == "enforce_cad_edge_sizes" )
1359 SetEnforceCadEdgesSize( GetImpl()->ToBool( optionValue ));
1361 else if ( name == "jacobian_rectification_respect_geometry" )
1362 SetJacobianRectificationRespectGeometry( GetImpl()->ToBool( optionValue ));
1364 else if ( name == "max_number_of_points_per_patch" )
1365 SetMaxNumberOfPointsPerPatch( GetImpl()->ToInt( optionValue ));
1367 else if ( name == "max_number_of_threads" )
1368 SetMaxNumberOfThreads( GetImpl()->ToInt( optionValue ));
1370 else if ( name == "rectify_jacobian" )
1371 SetJacobianRectification( GetImpl()->ToBool( optionValue ));
1373 else if ( name == "use_deprecated_patch_mesher" )
1374 SetUseDeprecatedPatchMesher( GetImpl()->ToBool( optionValue ));
1376 else if ( name == "respect_geometry" )
1377 SetRespectGeometry( GetImpl()->ToBool( optionValue ));
1379 else if ( name == "tiny_edge_avoid_surface_intersections" )
1380 SetTinyEdgesAvoidSurfaceIntersections( GetImpl()->ToBool( optionValue ));
1382 else if ( name == "closed_geometry" )
1383 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1385 else if ( name == "debug" )
1386 SetDebug( GetImpl()->ToBool( optionValue ));
1388 else if ( name == "discard_input_topology" )
1389 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1391 else if ( name == "merge_edges" )
1392 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1394 else if ( name == "periodic_tolerance" )
1395 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1397 else if ( name == "remove_duplicate_cad_faces" )
1398 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1400 else if ( name == "required_entities" )
1401 SetRequiredEntities( optionValue );
1403 else if ( name == "sewing_tolerance" )
1404 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1406 else if ( name == "tags" )
1407 SetTags( optionValue );
1409 // other basic options with specific methods
1411 else if ( name == "correct_surface_intersections" )
1412 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1414 else if ( name == "optimise_tiny_edges" )
1415 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1417 else if ( name == "surface_intersections_processing_max_cost" )
1418 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1420 else if ( name == "volume_gradation" )
1421 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1423 else if ( name == "tiny_edge_optimisation_length" )
1424 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1426 else if ( name == "proximity" )
1427 SetVolumeProximity( GetImpl()->ToBool( optionValue ));
1429 else if ( name == "prox_ratio" )
1430 SetVolumeProximityRatio( GetImpl()->ToDbl( optionValue ));
1432 else if ( name == "prox_nb_layer" )
1433 SetNbVolumeProximityLayers( GetImpl()->ToInt( optionValue ));
1435 // advanced options (for backward compatibility)
1437 else if ( name == "create_tag_on_collision" ||
1438 name == "tiny_edge_respect_geometry" )
1439 AddOption( optionName, optionValue );
1443 valueChanged = ( this->GetImpl()->GetOptionValue( name ) != optionValue &&
1444 this->GetImpl()->GetOptionValue( name, &valueChanged ) != optionValue );
1447 this->GetImpl()->SetOptionValue(optionName, optionValue);
1448 SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
1451 } catch (const std::invalid_argument& ex) {
1452 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1453 } catch (SALOME_Exception& ex) {
1454 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1458 //=============================================================================
1460 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, const char* optionValue)
1461 throw (SALOME::SALOME_Exception) {
1463 bool valueChanged = false;
1465 std::string name( optionName );
1466 if ( !optionValue || !optionValue[0] )
1467 UnsetOption( optionName );
1469 else if ( name == "closed_geometry" )
1470 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1472 else if ( name == "debug" )
1473 SetDebug( GetImpl()->ToBool( optionValue ));
1475 else if ( name == "discard_input_topology" )
1476 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1478 else if ( name == "merge_edges" )
1479 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1481 else if ( name == "periodic_tolerance" )
1482 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1484 else if ( name == "remove_duplicate_cad_faces" )
1485 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1487 else if ( name == "required_entities" )
1488 SetRequiredEntities( optionValue );
1490 else if ( name == "sewing_tolerance" )
1491 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1493 else if ( name == "tags" )
1494 SetTags( optionValue );
1496 // other basic options with specific methods
1498 else if ( name == "correct_surface_intersections" )
1499 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1501 else if ( name == "optimise_tiny_edges" )
1502 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1504 else if ( name == "surface_intersections_processing_max_cost" )
1505 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1507 else if ( name == "volume_gradation" )
1508 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1510 else if ( name == "tiny_edge_optimisation_length" )
1511 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1513 else if ( name == "process_3d_topology" )
1514 SetPreCADProcess3DTopology( GetImpl()->ToBool( optionValue ));
1516 // advanced options (for backward compatibility)
1518 else if ( name == "create_tag_on_collision" ||
1519 name == "tiny_edge_respect_geometry" ||
1520 name == "remove_tiny_edges" ||
1521 name == "tiny_edge_length")
1522 AddPreCADOption( optionName, optionValue );
1525 valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue);
1527 this->GetImpl()->SetPreCADOptionValue(optionName, optionValue);
1529 } catch (const std::invalid_argument& ex) {
1530 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1531 } catch (SALOME_Exception& ex) {
1532 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1535 SMESH::TPythonDump() << _this() << ".SetPreCADOptionValue( '" << optionName << "', '" << optionValue << "' )";
1538 //=============================================================================
1540 char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1544 return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName,&isDefault).c_str());
1545 } catch (const std::invalid_argument& ex) {
1546 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1547 } catch (SALOME_Exception& ex) {
1548 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1553 //=============================================================================
1555 char* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1559 return CORBA::string_dup(this->GetImpl()->GetPreCADOptionValue(optionName,&isDefault).c_str());
1560 } catch (const std::invalid_argument& ex) {
1561 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1562 } catch (SALOME_Exception& ex) {
1563 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1568 //=============================================================================
1570 void BLSURFPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
1572 if ( !GetImpl()->GetOptionValue( optionName ).empty() )
1574 this->GetImpl()->ClearOption(optionName);
1575 SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
1579 //=============================================================================
1581 void BLSURFPlugin_Hypothesis_i::UnsetPreCADOption(const char* optionName) {
1583 if ( !GetImpl()->GetPreCADOptionValue( optionName ).empty() )
1585 this->GetImpl()->ClearPreCADOption(optionName);
1586 SMESH::TPythonDump() << _this() << ".UnsetPreCADOption( '" << optionName << "' )";
1590 //=============================================================================
1592 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() {
1594 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1596 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
1597 result->length(opts.size());
1601 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1602 for (; opIt != opts.end(); ++opIt, ++i) {
1603 string name_value_type = opIt->first;
1604 if (!opIt->second.empty()) {
1605 name_value_type += ":";
1606 name_value_type += GetImpl()->GetOptionValue( opIt->first, &isDefault );
1607 name_value_type += isDefault ? ":0" : ":1";
1609 result[i] = CORBA::string_dup(name_value_type.c_str());
1612 return result._retn();
1615 //=============================================================================
1617 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() {
1619 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1621 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
1622 result->length(opts.size());
1626 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1627 for (; opIt != opts.end(); ++opIt, ++i) {
1628 string name_value_type = opIt->first;
1629 if (!opIt->second.empty()) {
1630 name_value_type += ":";
1631 name_value_type += GetImpl()->GetPreCADOptionValue( opIt->first, &isDefault );
1632 name_value_type += isDefault ? ":0" : ":1";
1634 result[i] = CORBA::string_dup(name_value_type.c_str());
1636 return result._retn();
1639 //=============================================================================
1641 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAdvancedOptionValues()
1643 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1645 const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
1646 result->length(custom_opts.size());
1649 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = custom_opts.begin();
1650 for (; opIt != custom_opts.end(); ++opIt, ++i) {
1651 string name_value_type = opIt->first;
1652 if (!opIt->second.empty()) {
1653 name_value_type += ":";
1654 name_value_type += opIt->second;
1655 name_value_type += ":1"; // user defined
1657 result[i] = CORBA::string_dup(name_value_type.c_str());
1659 return result._retn();
1662 //=============================================================================
1664 void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
1665 throw (SALOME::SALOME_Exception) {
1667 for (CORBA::ULong i = 0; i < options.length(); ++i) {
1668 string name_value_type = options[i].in();
1669 if(name_value_type.empty())
1671 size_t colonPos = name_value_type.find(':');
1673 if (colonPos == string::npos) // ':' not found
1674 name = name_value_type;
1676 name = name_value_type.substr(0, colonPos);
1677 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1678 string value_type = name_value_type.substr(colonPos + 1);
1679 colonPos = value_type.find(':');
1680 value = value_type.substr(0, colonPos);
1681 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1682 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1686 SetOptionValue(name.c_str(), value.c_str());
1690 //=============================================================================
1692 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string_array& options)
1693 throw (SALOME::SALOME_Exception) {
1695 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1696 string name_value_type = options[i].in();
1697 if(name_value_type.empty())
1699 size_t colonPos = name_value_type.find(':');
1701 if (colonPos == string::npos) // ':' not found
1702 name = name_value_type;
1704 name = name_value_type.substr(0, colonPos);
1705 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1706 string value_type = name_value_type.substr(colonPos + 1);
1707 colonPos = value_type.find(':');
1708 value = value_type.substr(0, colonPos);
1709 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1710 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1714 SetPreCADOptionValue(name.c_str(), value.c_str());
1718 //=============================================================================
1720 void BLSURFPlugin_Hypothesis_i::SetAdvancedOptionValues(const BLSURFPlugin::string_array& options)
1722 SMESH::TPythonDump dump;
1724 string optionsAndValues;
1725 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1726 string name_value_type = options[i].in();
1727 if(name_value_type.empty())
1729 size_t colonPos = name_value_type.find(':');
1731 if (colonPos == string::npos) // ':' not found
1732 name = name_value_type;
1734 name = name_value_type.substr(0, colonPos);
1735 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1736 string value_type = name_value_type.substr(colonPos + 1);
1737 colonPos = value_type.find(':');
1738 value = value_type.substr(0, colonPos);
1741 AddOption(name.c_str(), value.c_str());
1743 optionsAndValues += name + " " + value + " ";
1746 if ( !optionsAndValues.empty() )
1747 dump << _this() << ".SetAdvancedOptions( '" << optionsAndValues.c_str() << "' )";
1750 //=============================================================================
1752 void BLSURFPlugin_Hypothesis_i::SetAdvancedOption(const char* optionsAndValues)
1753 throw (SALOME::SALOME_Exception)
1755 if ( !optionsAndValues ) return;
1757 SMESH::TPythonDump dump;
1759 std::istringstream strm( optionsAndValues );
1760 std::istream_iterator<std::string> sIt( strm ), sEnd;
1761 while ( sIt != sEnd )
1763 std::string option = *sIt;
1764 if ( ++sIt != sEnd )
1766 std::string value = *sIt;
1768 AddOption( option.c_str(), value.c_str() );
1772 THROW_SALOME_CORBA_EXCEPTION( "Uneven number of options and values" ,SALOME::BAD_PARAM );
1775 dump << _this() << ".SetAdvancedOption( '" << optionsAndValues << "' )";
1778 //=============================================================================
1780 void BLSURFPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
1782 // backward compatibility
1784 std::string name( optionName );
1785 if ( name == "proximity" )
1786 SetVolumeProximity( GetImpl()->ToBool( optionValue ));
1788 else if ( name == "prox_ratio" )
1789 SetVolumeProximityRatio( GetImpl()->ToDbl( optionValue ));
1791 else if ( name == "prox_nb_layer" )
1792 SetNbVolumeProximityLayers( GetImpl()->ToInt( optionValue ));
1794 bool valueChanged = (this->GetImpl()->GetOption(optionName) != optionValue);
1796 this->GetImpl()->AddOption(optionName, optionValue);
1797 SMESH::TPythonDump() << _this() << ".AddOption( '" << optionName << "', '" << optionValue << "' )";
1801 //=============================================================================
1803 void BLSURFPlugin_Hypothesis_i::AddPreCADOption(const char* optionName, const char* optionValue)
1806 bool valueChanged = (this->GetImpl()->GetPreCADOption(optionName) != optionValue);
1808 this->GetImpl()->AddPreCADOption(optionName, optionValue);
1809 SMESH::TPythonDump() << _this() << ".AddPreCADOption( '" << optionName << "', '" << optionValue << "' )";
1813 //=============================================================================
1815 char* BLSURFPlugin_Hypothesis_i::GetOption(const char* optionName)
1818 return CORBA::string_dup(this->GetImpl()->GetOption(optionName).c_str());
1821 //=============================================================================
1823 char* BLSURFPlugin_Hypothesis_i::GetPreCADOption(const char* optionName)
1826 return CORBA::string_dup(this->GetImpl()->GetPreCADOption(optionName).c_str());
1829 //=============================================================================
1831 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
1832 throw (SALOME::SALOME_Exception) {
1834 if ( !entry || !entry[0] )
1835 THROW_SALOME_CORBA_EXCEPTION( "SetSizeMapEntry(): empty geom entry", SALOME::BAD_PARAM );
1836 bool valueChanged = false;
1838 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap);
1840 this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
1841 } catch (const std::invalid_argument& ex) {
1842 SALOME::ExceptionStruct ExDescription;
1843 ExDescription.text = ex.what();
1844 ExDescription.type = SALOME::BAD_PARAM;
1845 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1846 ExDescription.lineNumber = 0;
1847 throw SALOME::SALOME_Exception(ExDescription);
1848 } catch (SALOME_Exception& ex) {
1849 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1852 SMESH::TPythonDump() << _this() << ".SetSizeMap(" << entry << ", '" << sizeMap << "' )";
1855 //=============================================================================
1857 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap)
1858 throw (SALOME::SALOME_Exception) {
1860 bool valueChanged = false;
1861 std::ostringstream sizeMapFunction;
1862 switch (shapeType) {
1863 case GEOM::FACE: sizeMapFunction << "def f(u,v): return " << sizeMap ; break;
1864 case GEOM::EDGE: sizeMapFunction << "def f(t): return " << sizeMap ; break;
1865 case GEOM::VERTEX: sizeMapFunction << "def f(): return " << sizeMap ; break;
1869 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str());
1871 this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str());
1872 } catch (const std::invalid_argument& ex) {
1873 SALOME::ExceptionStruct ExDescription;
1874 ExDescription.text = ex.what();
1875 ExDescription.type = SALOME::BAD_PARAM;
1876 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1877 ExDescription.lineNumber = 0;
1878 throw SALOME::SALOME_Exception(ExDescription);
1879 } catch (SALOME_Exception& ex) {
1880 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1883 SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", " << sizeMap << " )";
1886 //=============================================================================
1888 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
1889 throw (SALOME::SALOME_Exception) {
1891 bool valueChanged = false;
1893 valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
1894 if ( valueChanged ) {
1895 boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
1896 if (!boost::regex_match(string(attractor), re))
1897 throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
1898 this->GetImpl()->SetAttractorEntry(entry, attractor);
1900 } catch (const std::invalid_argument& ex) {
1901 SALOME::ExceptionStruct ExDescription;
1902 ExDescription.text = ex.what();
1903 ExDescription.type = SALOME::BAD_PARAM;
1904 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
1905 ExDescription.lineNumber = 0;
1906 throw SALOME::SALOME_Exception(ExDescription);
1907 } catch (SALOME_Exception& ex) {
1908 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1911 SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
1914 //=============================================================================
1916 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
1917 throw (SALOME::SALOME_Exception)
1920 //bool valueChanged = false;
1922 this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
1924 catch (const std::invalid_argument& ex) {
1925 SALOME::ExceptionStruct ExDescription;
1926 ExDescription.text = ex.what();
1927 ExDescription.type = SALOME::BAD_PARAM;
1928 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
1929 ExDescription.lineNumber = 0;
1930 throw SALOME::SALOME_Exception(ExDescription);
1931 } catch (SALOME_Exception& ex) {
1932 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1934 //if ( valueChanged )
1935 SMESH::TPythonDump() << _this() << ".SetAttractorGeom( "
1936 << entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
1939 //=============================================================================
1941 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1944 return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
1945 } catch (const std::invalid_argument& ex) {
1946 SALOME::ExceptionStruct ExDescription;
1947 ExDescription.text = ex.what();
1948 ExDescription.type = SALOME::BAD_PARAM;
1949 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
1950 ExDescription.lineNumber = 0;
1951 throw SALOME::SALOME_Exception(ExDescription);
1952 } catch (SALOME_Exception& ex) {
1953 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1958 //=============================================================================
1960 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1963 return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
1964 } catch (const std::invalid_argument& ex) {
1965 SALOME::ExceptionStruct ExDescription;
1966 ExDescription.text = ex.what();
1967 ExDescription.type = SALOME::BAD_PARAM;
1968 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
1969 ExDescription.lineNumber = 0;
1970 throw SALOME::SALOME_Exception(ExDescription);
1971 } catch (SALOME_Exception& ex) {
1972 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1977 // //=============================================================================
1979 // // TODO coder cette fonction (utilis??e pour savoir si la valeur a chang??
1980 // // A finir pour le dump
1981 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
1982 // throw (SALOME::SALOME_Exception)
1984 // ASSERT(myBaseImpl);
1986 // return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
1988 // catch (const std::invalid_argument& ex) {
1989 // SALOME::ExceptionStruct ExDescription;
1990 // ExDescription.text = ex.what();
1991 // ExDescription.type = SALOME::BAD_PARAM;
1992 // ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
1993 // ExDescription.lineNumber = 0;
1994 // throw SALOME::SALOME_Exception(ExDescription);
1996 // catch (SALOME_Exception& ex) {
1997 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2002 //=============================================================================
2004 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
2006 this->GetImpl()->ClearEntry(entry);
2007 // SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
2010 //=============================================================================
2012 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
2014 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
2016 const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
2017 result->length(sizeMaps.size());
2019 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
2020 for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
2021 string entry_sizemap = smIt->first;
2022 if (!smIt->second.empty()) {
2023 entry_sizemap += "|";
2024 entry_sizemap += smIt->second;
2026 result[i] = CORBA::string_dup(entry_sizemap.c_str());
2028 return result._retn();
2031 //=============================================================================
2033 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
2035 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
2037 const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
2038 result->length(attractors.size());
2040 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
2041 for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
2042 string entry_attractor = atIt->first;
2043 if (!atIt->second.empty()) {
2044 entry_attractor += "|";
2045 entry_attractor += atIt->second;
2047 result[i] = CORBA::string_dup(entry_attractor.c_str());
2049 return result._retn();
2052 //=============================================================================
2054 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
2057 BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
2059 const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
2060 result->length( attractors.size() );
2062 ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
2063 for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
2064 string faceEntry = atIt->first;
2066 double startSize, endSize, infDist, constDist;
2067 if ( !atIt->second->Empty() ) {
2068 attEntry = atIt->second->GetAttractorEntry();
2069 std::vector<double> params = atIt->second->GetParameters();
2070 startSize = params[0];
2071 endSize = params[1];
2072 infDist = params[2];
2073 constDist = params[3];
2075 result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
2076 result[i].attEntry = CORBA::string_dup(attEntry.c_str());
2077 result[i].startSize = startSize;
2078 result[i].endSize = endSize;
2079 result[i].infDist = infDist;
2080 result[i].constDist = constDist;
2082 return result._retn();
2085 //=============================================================================
2087 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
2088 throw (SALOME::SALOME_Exception) {
2090 for ( CORBA::ULong i = 0; i < sizeMaps.length(); ++i) {
2091 string entry_sizemap = sizeMaps[i].in();
2092 size_t colonPos = entry_sizemap.find('|');
2093 string entry, sizemap;
2094 if (colonPos == string::npos) // '|' separator not found
2095 entry = entry_sizemap;
2097 entry = entry_sizemap.substr(0, colonPos);
2098 if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
2099 sizemap = entry_sizemap.substr(colonPos + 1);
2101 this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
2105 //=============================================================================
2107 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
2109 this->GetImpl()->ClearSizeMaps();
2112 //=============================================================================
2114 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
2115 throw (SALOME::SALOME_Exception)
2119 entry = GeomObj->GetStudyEntry();
2120 SetSizeMapEntry(entry.c_str(), sizeMap);
2123 //=============================================================================
2125 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) {
2127 string entry = GeomObj->GetStudyEntry();
2128 GEOM::shape_type shapeType = GeomObj->GetShapeType();
2129 if (shapeType == GEOM::COMPOUND)
2130 shapeType = GeomObj->GetMaxShapeType();
2131 SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
2134 //=============================================================================
2135 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
2138 entry = GeomObj->GetStudyEntry();
2139 UnsetEntry(entry.c_str());
2140 SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
2143 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
2146 entry = GeomObj->GetStudyEntry();
2147 SetAttractorEntry(entry.c_str(), attractor);
2150 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
2153 entry = GeomObj->GetStudyEntry();
2154 UnsetEntry(entry.c_str());
2155 SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
2158 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)
2161 string theFaceEntry;
2163 theFaceEntry = theFace->GetStudyEntry();
2164 theAttEntry = theAttractor->GetStudyEntry();
2166 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2169 if (theFaceEntry.empty()) {
2171 aName += theFace->GetEntry();
2172 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2173 if (!theSFace->_is_nil())
2174 theFaceEntry = theSFace->GetID();
2176 if (theFaceEntry.empty())
2177 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2179 if (theAttEntry.empty()) {
2180 if (theAttractor->GetShapeType() == GEOM::VERTEX)
2182 if (theAttractor->GetShapeType() == GEOM::EDGE)
2184 if (theAttractor->GetShapeType() == GEOM::WIRE)
2186 if (theAttractor->GetShapeType() == GEOM::COMPOUND)
2187 aName = "Compound_";
2188 aName += theAttractor->GetEntry();
2189 SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(NULL, theAttractor, aName.c_str());
2190 if (!theSAtt->_is_nil())
2191 theAttEntry = theSAtt->GetID();
2193 if (theAttEntry.empty())
2194 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2196 TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
2197 TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
2198 SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
2201 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
2202 GEOM::GEOM_Object_ptr theAttractor)
2205 CORBA::String_var theFaceEntry = theFace->GetStudyEntry();
2206 CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
2208 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2211 // if (theFaceEntry.empty()) {
2213 // aName += theFace->GetEntry();
2214 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2215 // if (!theSFace->_is_nil())
2216 // theFaceEntry = theSFace->GetID();
2218 if ( !theFaceEntry.in() || !theFaceEntry.in()[0] ||
2219 !theAttrEntry.in() || !theAttrEntry.in()[0] )
2220 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2222 GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
2223 SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
2224 << theFace << ", " << theAttractor << " )";
2227 void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry,
2228 const char* attractorEntry)
2230 GetImpl()->ClearEntry( faceEntry, attractorEntry );
2231 SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '"
2232 << faceEntry << "', '" << attractorEntry << "' )";
2237 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
2240 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
2243 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap ) throw (SALOME::SALOME_Exception)
2246 char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception)
2249 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
2252 this->GetImpl()->UnsetCustomSizeMap(entry);
2253 SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
2257 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
2262 // ///////////////////////
2263 // // ENFORCED VERTICES //
2264 // ///////////////////////
2268 * Returns the list of enforced vertices for a given Face entry
2269 * @return A map of Face entry / List of enforced vertices
2272 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
2275 BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
2277 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
2278 this->GetImpl()->_GetAllEnforcedVerticesByFace();
2279 resultMap->length(faceEntryEnfVertexListMap.size());
2281 ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
2282 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
2283 for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
2284 BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
2285 new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
2286 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2288 _enfVertexList = it_entry->second;
2289 BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
2290 enfVertexList->length(_enfVertexList.size());
2292 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
2293 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2294 for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
2295 currentEnfVertex = (*it_enfVertex);
2297 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2300 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2303 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2306 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2307 coords->length(currentEnfVertex->coords.size());
2308 for (CORBA::ULong i=0;i<coords->length();i++)
2309 coords[i] = currentEnfVertex->coords[i];
2310 enfVertex->coords = coords;
2313 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2316 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2317 faceEntryList->length(currentEnfVertex->faceEntries.size());
2318 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2319 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2320 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2321 enfVertex->faceEntries = faceEntryList;
2324 msg << "Enforced vertex: \n"
2325 << "Name: " << enfVertex->name << "\n";
2326 if (coords->length())
2327 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2328 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2329 << "Group Name: " << enfVertex->grpName;
2331 enfVertexList[j] = enfVertex;
2333 mapElement->enfVertexList = enfVertexList;
2335 resultMap[i] = mapElement;
2338 return resultMap._retn();
2342 * Returns the list of all enforced vertices
2343 * @return a list of enforced vertices
2346 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
2348 BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
2349 const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
2350 resultMap->length(enfVertexList.size());
2352 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
2353 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2354 for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
2355 currentEnfVertex = (*evlIt);
2356 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2358 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2360 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2362 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2363 coords->length(currentEnfVertex->coords.size());
2364 for (CORBA::ULong ind = 0; ind < coords->length(); ind++)
2365 coords[ind] = currentEnfVertex->coords[ind];
2366 enfVertex->coords = coords;
2368 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2370 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2371 faceEntryList->length(currentEnfVertex->faceEntries.size());
2372 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2373 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2374 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2375 enfVertex->faceEntries = faceEntryList;
2378 msg << "Enforced vertex: \n"
2379 << "Name: " << enfVertex->name << "\n";
2380 if (coords->length())
2381 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2382 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2383 << "Group Name: " << enfVertex->grpName;
2385 resultMap[i] = enfVertex;
2387 return resultMap._retn();
2392 * Returns the list of enforced vertices coords for a given Face entry.
2393 * They are the coords of the "manual" enforced vertices.
2394 * @return A map of Face entry / List of enforced vertices coords
2397 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
2400 BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
2402 const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
2403 resultMap->length(entryCoordsListMap.size());
2405 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
2406 ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
2407 for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
2408 BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
2409 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2411 _coordsList = it_entry->second;
2412 BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
2413 coordsList->length(_coordsList.size());
2415 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
2416 for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
2417 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2418 coords->length((*it_coords).size());
2419 for (CORBA::ULong i=0;i<coords->length();i++)
2420 coords[i] = (*it_coords)[i];
2421 coordsList[j] = coords;
2423 mapElement->coordsList = coordsList;
2425 resultMap[i] = mapElement;
2428 return resultMap._retn();
2432 * Returns a map of enforced vertices coords / enforced vertex.
2433 * They are the coords of the "manual" enforced vertices.
2435 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
2438 BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
2439 const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
2440 this->GetImpl()->_GetAllEnforcedVerticesByCoords();
2441 resultMap->length(coordsEnfVertexMap.size());
2443 ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
2444 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2445 for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
2446 currentEnfVertex = (it_coords->second);
2447 BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
2448 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2449 coords->length(it_coords->first.size());
2450 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2451 coords[ind] = it_coords->first[ind];
2452 mapElement->coords = coords;
2454 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2456 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2458 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2460 BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
2461 coords2->length(currentEnfVertex->coords.size());
2462 for (CORBA::ULong ind=0;ind<coords2->length();ind++)
2463 coords2[ind] = currentEnfVertex->coords[ind];
2464 enfVertex->coords = coords2;
2466 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2468 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2469 faceEntryList->length(currentEnfVertex->faceEntries.size());
2470 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2471 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2472 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2473 enfVertex->faceEntries = faceEntryList;
2475 mapElement->enfVertex = enfVertex;
2477 msg << "Enforced vertex: \n"
2478 << "Name: " << enfVertex->name << "\n";
2479 if (coords->length())
2480 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2481 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2482 << "Group Name: " << enfVertex->grpName;
2484 resultMap[i] = mapElement;
2486 return resultMap._retn();
2490 * Returns the list of enforced vertices entries for a given Face entry.
2491 * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
2492 * @return A map of Face entry / List of enforced vertices geom entries
2495 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
2498 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
2500 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
2501 this->GetImpl()->_GetAllEnfVertexEntriesByFace();
2502 resultMap->length(entryEnfVertexEntryListMap.size());
2504 ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
2505 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
2506 entryEnfVertexEntryListMap.begin();
2507 for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
2508 BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
2509 new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
2510 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2512 _enfVertexEntryList = it_entry->second;
2513 BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
2514 enfVertexEntryList->length(_enfVertexEntryList.size());
2516 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
2517 for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
2518 enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
2520 mapElement->enfVertexEntryList = enfVertexEntryList;
2522 resultMap[i] = mapElement;
2525 return resultMap._retn();
2529 * Returns a map of enforced vertices geom entry / enforced vertex.
2530 * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
2532 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
2535 BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
2536 const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
2537 this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
2538 resultMap->length(enfVertexEntryEnfVertexMap.size());
2540 ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
2541 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2542 for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
2543 currentEnfVertex = it_enfVertexEntry->second;
2544 BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
2545 mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
2547 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2549 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2551 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2553 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2554 coords->length(currentEnfVertex->coords.size());
2555 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2556 coords[ind] = currentEnfVertex->coords[ind];
2557 enfVertex->coords = coords;
2559 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2561 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2562 faceEntryList->length(currentEnfVertex->faceEntries.size());
2563 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2564 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2565 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2566 enfVertex->faceEntries = faceEntryList;
2569 msg << "Enforced vertex: \n"
2570 << "Name: " << enfVertex->name << "\n";
2571 if (coords->length())
2572 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2573 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2574 << "Group Name: " << enfVertex->grpName;
2576 mapElement->enfVertex = enfVertex;
2577 resultMap[i] = mapElement;
2579 return resultMap._retn();
2583 * Erase all enforced vertices
2585 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
2587 this->GetImpl()->ClearAllEnforcedVertices();
2588 SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
2592 * Set/get/unset an enforced vertex on face - OBSOLETE
2594 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2595 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2598 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2599 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2602 string theFaceEntry = theFace->GetStudyEntry();
2604 if (theFaceEntry.empty()) {
2605 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2607 if (theFace->GetShapeType() == GEOM::FACE)
2609 if (theFace->GetShapeType() == GEOM::COMPOUND)
2610 aName = "Compound_";
2611 aName += theFace->GetEntry();
2612 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2613 if (!theSFace->_is_nil())
2614 theFaceEntry = theSFace->GetID();
2616 if (theFaceEntry.empty())
2617 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2619 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2620 } catch (SALOME_Exception& ex) {
2621 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2626 * Set/get/unset an enforced vertex with name on face
2628 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2629 CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
2632 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2633 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2636 string theFaceEntry = theFace->GetStudyEntry();
2638 if (theFaceEntry.empty()) {
2639 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2641 if (theFace->GetShapeType() == GEOM::FACE)
2643 if (theFace->GetShapeType() == GEOM::COMPOUND)
2644 aName = "Compound_";
2645 aName += theFace->GetEntry();
2646 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2647 if (!theSFace->_is_nil())
2648 theFaceEntry = theSFace->GetID();
2650 if (theFaceEntry.empty())
2651 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2654 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
2655 } catch (SALOME_Exception& ex) {
2656 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2661 * Set/get/unset an enforced vertex with geom object on face
2663 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2664 throw (SALOME::SALOME_Exception) {
2667 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2668 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2671 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2672 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2675 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2676 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
2677 // if (CORBA::is_nil(measureOp))
2680 // CORBA::Double x, y, z;
2682 // measureOp->PointCoordinates(theVertex, x, y, z);
2684 string theFaceEntry = theFace->GetStudyEntry();
2685 string theVertexEntry = theVertex->GetStudyEntry();
2687 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2690 if (theFaceEntry.empty()) {
2691 if (theFace->GetShapeType() == GEOM::FACE)
2693 if (theFace->GetShapeType() == GEOM::COMPOUND)
2694 aName = "Compound_";
2695 aName += theFace->GetEntry();
2696 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2697 if (!theSFace->_is_nil())
2698 theFaceEntry = theSFace->GetID();
2700 if (theFaceEntry.empty())
2701 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2703 if (theVertexEntry.empty()) {
2704 if (theVertex->GetShapeType() == GEOM::VERTEX)
2706 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2707 aName = "Compound_";
2708 aName += theVertex->GetEntry();
2709 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
2710 if (!theSVertex->_is_nil())
2711 theVertexEntry = theSVertex->GetID();
2713 if (theVertexEntry.empty())
2714 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2716 string theVertexName = theVertex->GetName();
2718 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
2719 } catch (SALOME_Exception& ex) {
2720 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2725 * Set an enforced vertex with group name on face
2727 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
2728 throw (SALOME::SALOME_Exception)
2732 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2733 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2736 string theFaceEntry = theFace->GetStudyEntry();
2738 if (theFaceEntry.empty()) {
2739 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2741 if (theFace->GetShapeType() == GEOM::FACE)
2743 if (theFace->GetShapeType() == GEOM::COMPOUND)
2744 aName = "Compound_";
2745 aName += theFace->GetEntry();
2746 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2747 if (!theSFace->_is_nil())
2748 theFaceEntry = theSFace->GetID();
2750 if (theFaceEntry.empty())
2751 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2753 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
2754 } catch (SALOME_Exception& ex) {
2755 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2760 * Set an enforced vertex with name and group name on face
2762 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z,
2763 const char* theVertexName, const char* theGroupName)
2764 throw (SALOME::SALOME_Exception)
2768 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2769 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2772 string theFaceEntry = theFace->GetStudyEntry();
2774 if (theFaceEntry.empty()) {
2775 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2777 if (theFace->GetShapeType() == GEOM::FACE)
2779 if (theFace->GetShapeType() == GEOM::COMPOUND)
2780 aName = "Compound_";
2781 aName += theFace->GetEntry();
2782 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2783 if (!theSFace->_is_nil())
2784 theFaceEntry = theSFace->GetID();
2786 if (theFaceEntry.empty())
2787 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2789 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
2790 } catch (SALOME_Exception& ex) {
2791 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2796 * Set an enforced vertex with geom entry and group name on face
2798 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
2799 throw (SALOME::SALOME_Exception)
2803 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2804 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2807 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2808 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2811 string theFaceEntry = theFace->GetStudyEntry();
2812 string theVertexEntry = theVertex->GetStudyEntry();
2814 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2817 if (theFaceEntry.empty()) {
2818 if (theFace->GetShapeType() == GEOM::FACE)
2820 if (theFace->GetShapeType() == GEOM::COMPOUND)
2821 aName = "Compound_";
2822 aName += theFace->GetEntry();
2823 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2824 if (!theSFace->_is_nil())
2825 theFaceEntry = theSFace->GetID();
2827 if (theFaceEntry.empty())
2828 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2830 if (theVertexEntry.empty()) {
2831 if (theVertex->GetShapeType() == GEOM::VERTEX)
2833 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2834 aName = "Compound_";
2835 aName += theVertex->GetEntry();
2836 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
2837 if (!theSVertex->_is_nil())
2838 theVertexEntry = theSVertex->GetID();
2840 if (theVertexEntry.empty())
2841 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2843 string theVertexName = theVertex->GetName();
2845 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
2846 } catch (SALOME_Exception& ex) {
2847 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2851 //Enable internal enforced vertices on specific face if requested by user
2853 // * Are internal enforced vertices used for a face ?
2855 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
2856 // throw (SALOME::SALOME_Exception) {
2857 // ASSERT(myBaseImpl);
2859 // if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2860 // THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2863 // string theFaceEntry = theFace->GetStudyEntry();
2865 // if (theFaceEntry.empty()) {
2866 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2868 // if (theFace->GetShapeType() == GEOM::FACE)
2870 // if (theFace->GetShapeType() == GEOM::COMPOUND)
2871 // aName = "Compound_";
2872 // aName += theFace->GetEntry();
2873 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2874 // if (!theSFace->_is_nil())
2875 // theFaceEntry = theSFace->GetID();
2877 // if (theFaceEntry.empty())
2878 // THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2881 // return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
2882 // } catch (SALOME_Exception& ex) {
2883 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2888 * Get the list of all enforced vertices
2890 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
2891 throw (SALOME::SALOME_Exception) {
2894 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2895 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2898 string theFaceEntry = theFace->GetStudyEntry();
2900 if (theFaceEntry.empty()) {
2901 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2903 if (theFace->GetShapeType() == GEOM::FACE)
2905 if (theFace->GetShapeType() == GEOM::COMPOUND)
2906 aName = "Compound_";
2907 aName += theFace->GetEntry();
2908 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2909 if (!theSFace->_is_nil())
2910 theFaceEntry = theSFace->GetID();
2912 if (theFaceEntry.empty())
2913 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2916 return GetEnforcedVerticesEntry(theFaceEntry.c_str());
2917 } catch (SALOME_Exception& ex) {
2918 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2922 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2923 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2926 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2927 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2930 string theFaceEntry = theFace->GetStudyEntry();
2932 if (theFaceEntry.empty()) {
2933 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2935 if (theFace->GetShapeType() == GEOM::FACE)
2937 if (theFace->GetShapeType() == GEOM::COMPOUND)
2938 aName = "Compound_";
2939 aName += theFace->GetEntry();
2940 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2941 if (!theSFace->_is_nil())
2942 theFaceEntry = theSFace->GetID();
2944 if (theFaceEntry.empty())
2945 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2948 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2949 } catch (SALOME_Exception& ex) {
2950 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2954 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2955 throw (SALOME::SALOME_Exception) {
2958 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2959 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2961 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2962 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2965 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2966 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
2967 // if (CORBA::is_nil(measureOp))
2970 // CORBA::Double x, y, z;
2972 // measureOp->PointCoordinates(theVertex, x, y, z);
2974 std::string theFaceEntry = theFace->GetStudyEntry();
2975 std::string theVertexEntry = theVertex->GetStudyEntry();
2977 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2980 if (theFaceEntry.empty()) {
2981 if (theFace->GetShapeType() == GEOM::FACE)
2983 if (theFace->GetShapeType() == GEOM::COMPOUND)
2984 aName = "Compound_";
2985 aName += theFace->GetEntry();
2986 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2987 if (!theSFace->_is_nil())
2988 theFaceEntry = theSFace->GetID();
2990 if (theFaceEntry.empty())
2991 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2993 if (theVertexEntry.empty()) {
2994 if (theVertex->GetShapeType() == GEOM::VERTEX)
2996 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2997 aName = "Compound_";
2998 aName += theVertex->GetEntry();
2999 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
3000 if (!theSVertex->_is_nil())
3001 theVertexEntry = theSVertex->GetID();
3003 if (theVertexEntry.empty())
3004 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3008 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
3009 } catch (SALOME_Exception& ex) {
3010 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3014 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception) {
3017 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
3018 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
3021 string theFaceEntry = theFace->GetStudyEntry();
3023 if (theFaceEntry.empty()) {
3024 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
3026 if (theFace->GetShapeType() == GEOM::FACE)
3028 if (theFace->GetShapeType() == GEOM::COMPOUND)
3029 aName = "Compound_";
3030 aName += theFace->GetEntry();
3031 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
3032 if (!theSFace->_is_nil())
3033 theFaceEntry = theSFace->GetID();
3035 if (theFaceEntry.empty())
3036 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3040 return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
3041 } catch (SALOME_Exception& ex) {
3042 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3047 * Set/get/unset an enforced vertex on face - NEW (no face)
3049 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
3054 return SetEnforcedVertexEntry("", x, y, z);
3055 } catch (SALOME_Exception& ex) {
3056 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3061 * Set/get/unset an enforced vertex with name on face
3063 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception)
3066 return SetEnforcedVertexEntry("", x, y, z, theVertexName);
3067 } catch (SALOME_Exception& ex) {
3068 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3073 * Set/get/unset an enforced vertex with geom object on face
3075 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
3076 throw (SALOME::SALOME_Exception)
3078 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3079 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3081 string theVertexEntry = theVertex->GetStudyEntry();
3083 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theVertex );
3086 if (theVertexEntry.empty()) {
3087 if (theVertex->GetShapeType() == GEOM::VERTEX)
3089 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3090 aName = "Compound_";
3091 aName += theVertex->GetEntry();
3092 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
3093 if (!theSVertex->_is_nil())
3094 theVertexEntry = theSVertex->GetID();
3096 if (theVertexEntry.empty())
3097 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3099 string theVertexName = theVertex->GetName();
3101 return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
3102 } catch (SALOME_Exception& ex) {
3103 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3108 * Set an enforced vertex with group name on face
3110 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
3111 throw (SALOME::SALOME_Exception)
3116 return SetEnforcedVertexEntry("", x, y, z, "", "", theGroupName);
3117 } catch (SALOME_Exception& ex) {
3118 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3123 * Set an enforced vertex with name and group name on face
3125 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z,
3126 const char* theVertexName, const char* theGroupName)
3127 throw (SALOME::SALOME_Exception)
3132 return SetEnforcedVertexEntry("", x, y, z, theVertexName, "", theGroupName);
3133 } catch (SALOME_Exception& ex) {
3134 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3139 * Set an enforced vertex with geom entry and group name on face
3141 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
3142 throw (SALOME::SALOME_Exception)
3144 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3145 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3148 string theVertexEntry = theVertex->GetStudyEntry();
3150 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theVertex );
3153 if (theVertexEntry.empty()) {
3154 if (theVertex->GetShapeType() == GEOM::VERTEX)
3156 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3157 aName = "Compound_";
3158 aName += theVertex->GetEntry();
3159 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
3160 if (!theSVertex->_is_nil())
3161 theVertexEntry = theSVertex->GetID();
3163 if (theVertexEntry.empty())
3164 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3166 string theVertexName = theVertex->GetName();
3168 return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
3169 } catch (SALOME_Exception& ex) {
3170 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3174 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
3177 return UnsetEnforcedVertexEntry("", x, y, z);
3178 } catch (SALOME_Exception& ex) {
3179 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3183 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
3184 throw (SALOME::SALOME_Exception)
3186 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3187 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3189 std::string theVertexEntry = theVertex->GetStudyEntry();
3191 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theVertex );
3194 if (theVertexEntry.empty()) {
3195 if (theVertex->GetShapeType() == GEOM::VERTEX)
3197 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3198 aName = "Compound_";
3199 aName += theVertex->GetEntry();
3200 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
3201 if (!theSVertex->_is_nil())
3202 theVertexEntry = theSVertex->GetID();
3204 if (theVertexEntry.empty())
3205 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3208 return UnsetEnforcedVertexEntry("", 0, 0, 0, theVertexEntry.c_str());
3209 } catch (SALOME_Exception& ex) {
3210 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3214 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertices() throw (SALOME::SALOME_Exception)
3217 return UnsetEnforcedVerticesEntry("");
3218 } catch (SALOME_Exception& ex) {
3219 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3224 * Set/get/unset an enforced vertex on geom object given by entry
3226 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry,
3230 const char* theVertexName,
3231 const char* theVertexEntry,
3232 const char* theGroupName)
3233 throw (SALOME::SALOME_Exception)
3235 bool newValue = false;
3236 if (string(theVertexEntry).empty()) {
3238 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
3239 this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
3240 ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
3241 coords.push_back(x);
3242 coords.push_back(y);
3243 coords.push_back(z);
3244 if (coordsList.find(coords) == coordsList.end()) {
3247 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
3248 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3252 } catch (const std::invalid_argument& ex) {
3253 // no enforced vertex for entry
3257 if (string(theVertexName).empty()) {
3258 if (string(theGroupName).empty())
3259 SMESH::TPythonDump() << _this() << ".AddEnforcedVertex(" << x << ", " << y << ", " << z << ")";
3261 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
3264 if (string(theGroupName).empty())
3265 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
3267 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", \""
3268 << theVertexName << "\", \"" << theGroupName << "\")";
3273 ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
3274 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
3275 if ( it == enfVertexEntryList.end()) {
3279 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
3280 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3284 } catch (const std::invalid_argument& ex) {
3285 // no enforced vertex for entry
3289 if (string(theGroupName).empty())
3290 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeom(" << theVertexEntry << ")";
3292 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeomWithGroup(" << theVertexEntry << ", \"" << theGroupName << "\")";
3297 this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
3302 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
3303 throw (SALOME::SALOME_Exception)
3306 BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
3307 ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
3308 vertexList->length(_vList.size());
3309 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
3310 for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
3311 ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
3313 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
3316 enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
3317 // Geom Vertex Entry
3318 enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
3320 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
3321 coords->length(_enfVertex->coords.size());
3322 for ( CORBA::ULong ind = 0; ind < coords->length(); ind++ )
3323 coords[ind] = _enfVertex->coords[ind];
3324 enfVertex->coords = coords;
3326 enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
3328 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
3329 faceEntryList->length(_enfVertex->faceEntries.size());
3330 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
3331 for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
3332 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
3333 enfVertex->faceEntries = faceEntryList;
3335 vertexList[i] = enfVertex;
3337 return vertexList._retn();
3338 } catch (const std::invalid_argument& ex) {
3339 SALOME::ExceptionStruct ExDescription;
3340 ExDescription.text = ex.what();
3341 ExDescription.type = SALOME::BAD_PARAM;
3342 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
3343 ExDescription.lineNumber = 1385;
3344 throw SALOME::SALOME_Exception(ExDescription);
3345 } catch (const std::exception& ex) {
3346 std::cout << "Exception: " << ex.what() << std::endl;
3347 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3351 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception)
3357 res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
3359 if (string(theVertexEntry).empty())
3360 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertex(" << x << ", " << y << ", " << z
3363 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom(" << theVertexEntry << ")";
3365 } catch (const std::invalid_argument& ex) {
3367 } catch (const std::exception& ex) {
3368 std::cout << "Exception: " << ex.what() << std::endl;
3369 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3374 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception)
3379 this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
3380 SMESH::TPythonDump() << _this() << ".RemoveEnforcedVertices()";
3381 } catch (const std::invalid_argument& ex) {
3383 } catch (const std::exception& ex) {
3384 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3390 //=============================================================================
3392 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
3396 //=============================================================================
3397 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue)
3400 this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
3401 std::string theValueStr = theValue ? "True" : "False";
3402 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
3405 //=============================================================================
3407 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
3411 //=============================================================================
3412 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces()
3415 return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
3418 //=============================================================================
3420 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
3424 //=============================================================================
3425 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName)
3428 this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
3429 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
3432 //=============================================================================
3434 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
3438 //=============================================================================
3439 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup()
3442 return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
3446 * Enable internal enforced vertices on specific face if requested by user
3448 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
3449 throw (SALOME::SALOME_Exception)
3452 SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
3453 } catch (SALOME_Exception& ex) {
3454 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3458 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3459 throw (SALOME::SALOME_Exception)
3462 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
3463 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
3466 string theFaceEntry = theFace->GetStudyEntry();
3468 if (theFaceEntry.empty()) {
3469 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
3470 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3472 if (theFace->GetShapeType() == GEOM::FACE)
3474 if (theFace->GetShapeType() == GEOM::COMPOUND)
3475 aName = "Compound_";
3476 aName += theFace->GetEntry();
3477 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
3478 if (!theSFace->_is_nil())
3479 theFaceEntry = theSFace->GetID();
3481 if (theFaceEntry.empty())
3482 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3485 SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
3486 } catch (SALOME_Exception& ex) {
3487 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3491 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3492 throw (SALOME::SALOME_Exception)
3496 this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
3497 std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
3498 if (string(theGroupName).empty())
3499 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
3501 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
3502 } catch (const std::exception& ex) {
3503 std::cout << "Exception: " << ex.what() << std::endl;
3504 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3511 char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
3512 throw (SALOME::SALOME_Exception)
3516 return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
3518 catch (const std::invalid_argument& ex) {
3519 SALOME::ExceptionStruct ExDescription;
3520 ExDescription.text = ex.what();
3521 ExDescription.type = SALOME::BAD_PARAM;
3522 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
3523 ExDescription.lineNumber = 1146;
3524 throw SALOME::SALOME_Exception(ExDescription);
3526 catch (SALOME_Exception& ex) {
3527 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3533 void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
3534 throw (SALOME::SALOME_Exception)
3538 this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
3540 catch (const std::invalid_argument& ex) {
3541 SALOME::ExceptionStruct ExDescription;
3542 ExDescription.text = ex.what();
3543 ExDescription.type = SALOME::BAD_PARAM;
3544 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
3545 ExDescription.lineNumber = 1170;
3546 throw SALOME::SALOME_Exception(ExDescription);
3548 catch (SALOME_Exception& ex) {
3549 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3552 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
3553 << x << ", " << y << ", " << z << ", '" << groupName << "' )";
3557 ///////////////////////
3559 ///////////////////////
3561 ///////////////////////
3564 std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
3566 std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
3567 MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
3568 MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
3569 MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID");
3570 MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL");
3571 MapShapeTypeToString[GEOM::FACE] = std::string("FACE");
3572 MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE");
3573 MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE");
3574 MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX");
3575 MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE");
3576 std::string txtShapeType = MapShapeTypeToString[theShapeType];
3577 return txtShapeType;
3580 void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes)
3582 // Check shape types
3584 std::stringstream typesTxt;
3585 for (std::size_t i=0; i<theShapeTypes.size(); i++)
3587 GEOM::shape_type theShapeType = theShapeTypes[i];
3588 if (shape->GetShapeType() == theShapeType)
3590 typesTxt << ShapeTypeToString(theShapeType);
3591 if (i < theShapeTypes.size()-1 )
3595 std::stringstream msg;
3596 msg << "shape type is not in" << typesTxt.str();
3597 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3601 void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType)
3604 if (shape->GetShapeType() != theShapeType) {
3605 std::stringstream msg;
3606 msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
3607 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3611 std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix)
3613 // Check shape is published in the object browser
3614 string shapeEntry = shape->GetStudyEntry();
3616 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( shape );
3619 // Publish shape if needed
3620 if (shapeEntry.empty()) {
3621 if (shape->GetShapeType() == theShapeType)
3623 aName += shape->GetEntry();
3624 SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(NULL, shape, aName.c_str());
3625 if (!theSFace1->_is_nil())
3626 shapeEntry = theSFace1->GetID();
3628 if (shapeEntry.empty())
3629 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3633 // Format the output of two vectors to use it in MESSAGE and PythonDump
3634 std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
3636 std::stringstream listEntriesTxt;
3638 if (!theSourceVerticesEntries.empty())
3640 listEntriesTxt << ", [" ;
3642 for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
3645 listEntriesTxt << ", ";
3646 listEntriesTxt << *it;
3649 listEntriesTxt << "], [" ;
3651 for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
3654 listEntriesTxt << ", ";
3655 listEntriesTxt << *it;
3657 listEntriesTxt << "]" ;
3659 return listEntriesTxt.str();
3663 * Erase all PreCad periodicity associations
3665 void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
3667 this->GetImpl()->ClearPreCadPeriodicityVectors();
3668 SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
3671 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
3673 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3674 this->GetImpl()->_GetPreCadFacesPeriodicityVector();
3676 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3678 return periodicityList._retn();
3681 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
3683 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3684 this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
3686 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3688 return periodicityList._retn();
3691 // convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
3692 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
3694 BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
3696 periodicityList->length(preCadPeriodicityVector.size());
3698 for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
3700 ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
3702 BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
3703 myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
3704 myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
3706 BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
3707 if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
3709 sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
3710 for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
3711 sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
3714 myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
3716 BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
3717 if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
3719 targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
3720 for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
3721 targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
3724 myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
3726 periodicityList[i] = myPreCadPeriodicity;
3730 return periodicityList._retn();
3734 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
3735 throw (SALOME::SALOME_Exception)
3738 const GEOM::ListOfGO theSourceVertices;
3739 const GEOM::ListOfGO theTargetVertices;
3740 AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices);
3744 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
3745 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3746 throw (SALOME::SALOME_Exception)
3750 size_t theLength = theSourceVertices.length();
3751 if (theLength != theTargetVertices.length())
3752 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3754 std::vector<GEOM::shape_type> allowedShapeTypes;
3755 allowedShapeTypes.push_back(GEOM::FACE);
3756 allowedShapeTypes.push_back(GEOM::COMPOUND);
3758 string prefix1 = "Source_face_";
3759 CheckShapeTypes(theFace1, allowedShapeTypes);
3760 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
3762 string prefix2 = "Target_face_";
3763 CheckShapeTypes(theFace2, allowedShapeTypes);
3764 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
3766 string prefix3 = "Source_vertex_";
3767 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3768 theSourceVerticesEntries->length(theLength);
3769 GEOM::GEOM_Object_ptr theVtx_i;
3771 for (size_t ind = 0; ind < theLength; ind++) {
3772 theVtx_i = theSourceVertices[ind];
3773 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3774 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3777 string prefix4 = "Target_vertex_";
3778 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3779 theTargetVerticesEntries->length(theLength);
3780 for (size_t ind = 0; ind < theLength; ind++) {
3781 theVtx_i = theTargetVertices[ind];
3782 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3783 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3786 string theFace2Name = theFace2->GetName();
3788 AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
3789 theSourceVerticesEntries, theTargetVerticesEntries);
3790 } catch (SALOME_Exception& ex) {
3791 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3796 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
3797 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3798 throw (SALOME::SALOME_Exception)
3803 // Convert BLSURFPlugin::TEntryList to vector<string>
3804 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3805 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3806 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3807 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3810 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3813 this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
3814 theSourceVerticesEntries, theTargetVerticesEntries);
3816 SMESH::TPythonDump pd;
3817 if (!theSourceVerticesEntries.empty())
3819 pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
3820 pd << listEntriesTxt.c_str();
3824 pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
3827 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
3828 throw (SALOME::SALOME_Exception)
3831 const GEOM::ListOfGO theSourceVertices;
3832 const GEOM::ListOfGO theTargetVertices;
3833 AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices);
3836 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
3837 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3838 throw (SALOME::SALOME_Exception)
3842 size_t theLength = theSourceVertices.length();
3843 if (theLength != theTargetVertices.length())
3844 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3846 std::vector<GEOM::shape_type> allowedShapeTypes;
3847 allowedShapeTypes.push_back(GEOM::EDGE);
3848 allowedShapeTypes.push_back(GEOM::COMPOUND);
3850 string prefix1 = "Source_edge_";
3851 CheckShapeTypes(theEdge1, allowedShapeTypes);
3852 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1);
3854 string prefix2 = "Target_edge_";
3855 CheckShapeTypes(theEdge2, allowedShapeTypes);
3856 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
3858 string prefix3 = "Source_vertex_";
3859 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3860 theSourceVerticesEntries->length(theLength);
3861 GEOM::GEOM_Object_ptr theVtx_i;
3863 for (size_t ind = 0; ind < theLength; ind++) {
3864 theVtx_i = theSourceVertices[ind];
3865 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3866 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3869 string prefix4 = "Target_vertex_";
3870 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3871 theTargetVerticesEntries->length(theLength);
3872 for (size_t ind = 0; ind < theLength; ind++) {
3873 theVtx_i = theTargetVertices[ind];
3874 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3875 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3878 string theEdge2Name = theEdge2->GetName();
3880 AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
3881 theSourceVerticesEntries, theTargetVerticesEntries);
3882 } catch (SALOME_Exception& ex) {
3883 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3888 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
3889 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3890 throw (SALOME::SALOME_Exception)
3895 // Convert BLSURFPlugin::TEntryList to vector<string>
3896 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3897 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3898 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3899 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3902 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3904 this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
3905 theSourceVerticesEntries, theTargetVerticesEntries);
3907 SMESH::TPythonDump pd;
3908 if (!theSourceVerticesEntries.empty())
3910 pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
3911 pd << listEntriesTxt.c_str();
3915 pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
3920 //================================================================================
3922 * \brief Sets the file for export resulting mesh in GMF format
3923 * \param theFileName - full name of the file (.mesh, .meshb)
3925 * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
3927 //================================================================================
3928 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
3929 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
3931 bool valueChanged/*, modeChanged*/ = false;
3933 valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
3934 // modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
3935 if (valueChanged)// or (!valueChanged && modeChanged))
3936 this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
3937 } catch (const std::exception& ex) {
3938 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3940 if (valueChanged)// or (!valueChanged && modeChanged))
3941 SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
3944 //================================================================================
3946 * \brief Gets the file name for export resulting mesh in GMF format
3947 * \retval char* - The file name
3949 * Returns the GMF file name
3951 //================================================================================
3952 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
3954 return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
3957 // //================================================================================
3959 // * \brief Gets the file mode for export resulting mesh in GMF format
3960 // * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
3962 // * Returns the GMF file mode
3964 // //================================================================================
3965 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
3966 // ASSERT(myBaseImpl);
3967 // return this->GetImpl()->GetGMFFileMode();
3970 //=============================================================================
3972 * BLSURFPlugin_Hypothesis_i::GetImpl
3974 * Get implementation
3976 //=============================================================================
3977 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
3978 return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
3981 //================================================================================
3983 * \brief Verify whether hypothesis supports given entity type
3984 * \param type - dimension (see SMESH::Dimension enumeration)
3985 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
3987 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
3989 //================================================================================
3990 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
3991 return type == SMESH::DIM_2D;
3995 //================================================================================
3997 * \brief Return geometry this hypothesis depends on. Return false if there is no geometry parameter
3999 //================================================================================
4002 BLSURFPlugin_Hypothesis_i::getObjectsDependOn( std::vector< std::string > & entryArray,
4003 std::vector< int > & subIDArray ) const
4005 typedef ::BLSURFPlugin_Hypothesis BH;
4006 const BH* impl = static_cast<const BH*>( myBaseImpl );
4009 const BH::TSizeMap& sizeMap = impl->_GetSizeMapEntries();
4010 BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
4011 for ( ; entry2size != sizeMap.cend(); ++entry2size )
4012 entryArray.push_back( entry2size->first );
4015 const BH::TSizeMap& sizeMap = impl->_GetAttractorEntries();
4016 BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
4017 for ( ; entry2size != sizeMap.cend(); ++entry2size )
4018 entryArray.push_back( entry2size->first );
4021 const BH::TAttractorMap& classAttractors = impl-> _GetClassAttractorEntries();
4022 BH::TAttractorMap::const_iterator entry2size = classAttractors.cbegin();
4023 for ( ; entry2size != classAttractors.cend(); ++entry2size )
4024 entryArray.push_back( entry2size->first );
4027 const BH::TFaceEntryEnfVertexListMap& faceEntryEnfVertexListMap = impl->_GetAllEnforcedVerticesByFace();
4028 BH::TFaceEntryEnfVertexListMap::const_iterator entry2evList = faceEntryEnfVertexListMap.cbegin();
4029 for ( ; entry2evList != faceEntryEnfVertexListMap.cend(); ++entry2evList )
4031 entryArray.push_back( entry2evList->first );
4033 const BH::TEnfVertexList& evList = entry2evList->second;
4034 BH::TEnfVertexList::const_iterator evIt = evList.cbegin();
4035 for ( ; evIt != evList.cend(); ++evIt )
4037 const BH::TEnfVertex* ev = *evIt;
4038 entryArray.push_back( ev->geomEntry );
4039 entryArray.insert( entryArray.end(), ev->faceEntries.cbegin(), ev->faceEntries.cend() );
4043 // { // duplicated data of faceEntryEnfVertexListMap
4044 // const BH::TEnfVertexList& enfVertexList = impl->_GetAllEnforcedVertices();
4045 // const BH::TFaceEntryCoordsListMap& faceEntryCoordsListMap = impl->_GetAllCoordsByFace();
4046 // const BH::TFaceEntryEnfVertexEntryListMap& faceEntryEnfVertexEntryListMap = impl->_GetAllEnfV // const BH::TEnfVertexEntryEnfVertexMap& enfVertexEntryEnfVertexMap = impl->_GetAllEnforcedVert // }
4048 const BH::TPreCadPeriodicityVector& preCadFacesPeriodicityVector = impl->_GetPreCadFacesPeriodicityVector();
4049 BH::TPreCadPeriodicityVector::const_iterator pcp = preCadFacesPeriodicityVector.cbegin();
4050 for ( ; pcp != preCadFacesPeriodicityVector.cend(); ++pcp )
4052 entryArray.push_back( pcp->shape1Entry );
4053 entryArray.push_back( pcp->shape2Entry );
4054 entryArray.insert( entryArray.end(),
4055 pcp->theSourceVerticesEntries.cbegin(),
4056 pcp->theSourceVerticesEntries.cend() );
4057 entryArray.insert( entryArray.end(),
4058 pcp->theTargetVerticesEntries.cbegin(),
4059 pcp->theTargetVerticesEntries.cend() );
4063 const BH::TPreCadPeriodicityVector& preCadEdgesPeriodicityVector = impl->_GetPreCadEdgesPeriodicityVector();
4064 BH::TPreCadPeriodicityVector::const_iterator pcp = preCadEdgesPeriodicityVector.cbegin();
4065 for ( ; pcp != preCadEdgesPeriodicityVector.cend(); ++pcp )
4067 entryArray.push_back( pcp->shape1Entry );
4068 entryArray.push_back( pcp->shape2Entry );
4069 entryArray.insert( entryArray.end(),
4070 pcp->theSourceVerticesEntries.cbegin(),
4071 pcp->theSourceVerticesEntries.cend() );
4072 entryArray.insert( entryArray.end(),
4073 pcp->theTargetVerticesEntries.cbegin(),
4074 pcp->theTargetVerticesEntries.cend() );
4078 const BH::THyperPatchList& hyperPatchList = impl->GetHyperPatches();
4079 BH::THyperPatchList::const_iterator idSet = hyperPatchList.cbegin();
4080 for ( ; idSet != hyperPatchList.cend(); ++idSet )
4082 subIDArray.insert( subIDArray.end(), idSet->cbegin(), idSet->cend() );
4088 //================================================================================
4090 * \brief Set new geometry instead of that returned by getObjectsDependOn()
4092 //================================================================================
4095 BLSURFPlugin_Hypothesis_i::setObjectsDependOn( std::vector< std::string > & entryArray,
4096 std::vector< int > & subIDArray )
4098 typedef ::BLSURFPlugin_Hypothesis BH;
4099 BH* impl = static_cast<BH*>( myBaseImpl );
4103 BH::TSizeMap& sizeMapNew = const_cast< BH::TSizeMap& >( impl->_GetSizeMapEntries() );
4104 BH::TSizeMap sizeMap;
4105 sizeMap.swap( sizeMapNew );
4106 BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
4107 for ( ; entry2size != sizeMap.cend(); ++entry2size, ++iEnt )
4108 if ( entryArray[ iEnt ].empty() == entry2size->first.empty() )
4109 sizeMapNew[ entryArray[ iEnt ]] = entry2size->second;
4112 BH::TSizeMap& sizeMapNew = const_cast< BH::TSizeMap& >( impl->_GetAttractorEntries() );
4113 BH::TSizeMap sizeMap;
4114 sizeMap.swap( sizeMapNew );
4115 BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
4116 for ( ; entry2size != sizeMap.cend(); ++entry2size, ++iEnt )
4117 if ( entryArray[ iEnt ].empty() == entry2size->first.empty() )
4118 sizeMapNew[ entryArray[ iEnt ]] = entry2size->second;
4121 BH::TAttractorMap& attrMapNew =
4122 const_cast< BH::TAttractorMap& > ( impl->_GetClassAttractorEntries() );
4123 BH::TAttractorMap attrMap;
4124 attrMap.swap( attrMapNew );
4125 BH::TAttractorMap::const_iterator entry2size = attrMap.cbegin();
4126 for ( ; entry2size != attrMap.cend(); ++entry2size, ++iEnt )
4127 if ( entryArray[ iEnt ].empty() == entry2size->first.empty() )
4128 attrMapNew.insert( std::make_pair( entryArray[ iEnt ], entry2size->second ));
4130 delete entry2size->second;
4133 BH::TFaceEntryEnfVertexListMap& faceEntryEnfVertexListMapNew =
4134 const_cast< BH::TFaceEntryEnfVertexListMap& >( impl->_GetAllEnforcedVerticesByFace() );
4135 BH::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap;
4136 faceEntryEnfVertexListMap.swap( faceEntryEnfVertexListMapNew );
4138 BH::TEnfVertexList& enfVertexList =
4139 const_cast< BH::TEnfVertexList& > ( impl->_GetAllEnforcedVertices() );
4140 enfVertexList.clear(); // avoid removal
4142 impl->ClearAllEnforcedVertices();
4144 BH::TFaceEntryEnfVertexListMap::iterator entry2evList = faceEntryEnfVertexListMap.begin();
4145 for ( ; entry2evList != faceEntryEnfVertexListMap.end(); ++entry2evList )
4147 const BH::TEntry& entry = entryArray[ iEnt++ ];
4148 bool faceOk = ( entry.empty() == entry2evList->first.empty() );
4150 BH::TEnfVertexList& evList = entry2evList->second;
4151 BH::TEnfVertexList::iterator evIt = evList.begin();
4152 for ( ; evIt != evList.end(); ++evIt )
4154 BH::TEnfVertex* ev = *evIt;
4155 bool ok = faceOk && ( ev->geomEntry.empty() != entryArray[ iEnt ].empty() );
4156 ev->geomEntry = entryArray[ iEnt++ ];
4157 BH::TEntryList faceEntriesNew;
4158 BH::TEntryList::iterator fEnt = ev->faceEntries.begin();
4159 for ( ; fEnt != ev->faceEntries.end(); ++fEnt, ++iEnt )
4161 if ( !entryArray[ iEnt ].empty() )
4162 faceEntriesNew.insert( entryArray[ iEnt ]);
4166 ev->faceEntries.swap( faceEntriesNew );
4167 impl->AddEnforcedVertex( entry, ev );
4177 BH::TPreCadPeriodicityVector& preCadPeriodicityVector =
4178 const_cast< BH::TPreCadPeriodicityVector&> ( impl->_GetPreCadFacesPeriodicityVector() );
4179 BH::TPreCadPeriodicityVector::iterator pcp = preCadPeriodicityVector.begin();
4180 for ( ; pcp != preCadPeriodicityVector.end(); ++pcp )
4182 pcp->shape1Entry = entryArray[ iEnt++ ];
4183 pcp->shape2Entry = entryArray[ iEnt++ ];
4184 for ( size_t i = 0; i < pcp->theSourceVerticesEntries.size(); ++i, iEnt++ )
4185 pcp->theSourceVerticesEntries[i] = entryArray[ iEnt ];
4187 for ( size_t i = 0; i < pcp->theTargetVerticesEntries.size(); ++i, iEnt++ )
4188 pcp->theTargetVerticesEntries[i] = entryArray[ iEnt ];
4192 BH::TPreCadPeriodicityVector& preCadPeriodicityVector =
4193 const_cast< BH::TPreCadPeriodicityVector&> ( impl->_GetPreCadEdgesPeriodicityVector() );
4194 BH::TPreCadPeriodicityVector::iterator pcp = preCadPeriodicityVector.begin();
4195 for ( ; pcp != preCadPeriodicityVector.end(); ++pcp )
4197 pcp->shape1Entry = entryArray[ iEnt++ ];
4198 pcp->shape2Entry = entryArray[ iEnt++ ];
4199 for ( size_t i = 0; i < pcp->theSourceVerticesEntries.size(); ++i, iEnt++ )
4200 pcp->theSourceVerticesEntries[i] = entryArray[ iEnt ];
4202 for ( size_t i = 0; i < pcp->theTargetVerticesEntries.size(); ++i, iEnt++ )
4203 pcp->theTargetVerticesEntries[i] = entryArray[ iEnt ];
4209 BH::THyperPatchList& hyperPatchListNew =
4210 const_cast< BH::THyperPatchList& >( impl->GetHyperPatches() );
4211 BH::THyperPatchList hyperPatchList;
4212 hyperPatchList.swap( hyperPatchListNew );
4213 BH::THyperPatchList::iterator idSet = hyperPatchList.begin();
4214 for ( ; idSet != hyperPatchList.end(); ++idSet )
4216 BH::THyperPatchTags& ids = *idSet;
4217 BH::THyperPatchTags idsNew;
4218 BH::THyperPatchTags::iterator i = ids.begin();
4219 for ( ; i != ids.end(); ++i, ++iID )
4220 if ( subIDArray[ iID ] > 0 )
4221 idsNew.insert( subIDArray[ iID ]);
4222 if ( !idsNew.empty() )
4223 hyperPatchListNew.push_back( idsNew );
4227 return ( iEnt == entryArray.size() && iID == subIDArray.size() );