1 // Copyright (C) 2007-2021 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"
27 #include "BLSURFPlugin_BLSURF.hxx"
29 #include <SMESH_Gen.hxx>
30 #include <SMESH_Gen_i.hxx>
31 #include <SMESH_PythonDump.hxx>
33 #include <SALOMEDS_wrap.hxx>
34 #include <Utils_CorbaException.hxx>
35 #include <utilities.h>
39 #include <boost/regex.hpp>
43 //=============================================================================
45 * BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i
49 //=============================================================================
50 BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA,
51 ::SMESH_Gen* theGenImpl,
53 SALOME::GenericObj_i(thePOA), SMESH_Hypothesis_i(thePOA)
55 myBaseImpl = new ::BLSURFPlugin_Hypothesis(theGenImpl->GetANewId(),
61 //=============================================================================
63 * BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i
67 //=============================================================================
68 BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i()
72 //=============================================================================
74 * BLSURFPlugin_Hypothesis_i::GetMeshGemsVersion
76 * Get version of MeshGems suite.
78 //=============================================================================
79 char* BLSURFPlugin_Hypothesis_i::GetMeshGemsVersion()
81 return CORBA::string_dup( this->GetImpl()->GetMeshGemsVersion().c_str() );
84 //=============================================================================
86 * BLSURFPlugin_Hypothesis_i::SetPhysicalMesh
90 //=============================================================================
91 void BLSURFPlugin_Hypothesis_i::SetPhysicalMesh(CORBA::Long theValue)
94 this->GetImpl()->SetPhysicalMesh((::BLSURFPlugin_Hypothesis::PhysicalMesh) theValue);
95 SMESH::TPythonDump() << _this() << ".SetPhysicalMesh( " << theValue << " )";
98 //=============================================================================
100 * BLSURFPlugin_Hypothesis_i::GetPhysicalMesh
104 //=============================================================================
105 CORBA::Long BLSURFPlugin_Hypothesis_i::GetPhysicalMesh()
108 return this->GetImpl()->GetPhysicalMesh();
111 //=============================================================================
113 * BLSURFPlugin_Hypothesis_i::SetGeometricMesh
118 //=============================================================================
119 void BLSURFPlugin_Hypothesis_i::SetGeometricMesh(CORBA::Long theValue)
122 this->GetImpl()->SetGeometricMesh((::BLSURFPlugin_Hypothesis::GeometricMesh) theValue);
123 SMESH::TPythonDump() << _this() << ".SetGeometricMesh( " << theValue << " )";
126 //=============================================================================
128 * BLSURFPlugin_Hypothesis_i::GetGeometricMesh
132 //=============================================================================
133 CORBA::Long BLSURFPlugin_Hypothesis_i::GetGeometricMesh()
136 return this->GetImpl()->GetGeometricMesh();
139 //=============================================================================
141 * BLSURFPlugin_Hypothesis_i::SetPhySize
145 //=============================================================================
146 void BLSURFPlugin_Hypothesis_i::SetPhySize(CORBA::Double theValue)
149 this->GetImpl()->SetPhySize(theValue, false);
150 SMESH::TPythonDump() << _this() << ".SetPhySize( " << theValue << " )";
153 //=============================================================================
155 * BLSURFPlugin_Hypothesis_i::SetPhySizeRel
157 * Set Relative PhySize
159 //=============================================================================
160 void BLSURFPlugin_Hypothesis_i::SetPhySizeRel(CORBA::Double theValue)
163 this->GetImpl()->SetPhySize(theValue, true);
164 SMESH::TPythonDump() << _this() << ".SetPhySizeRel( " << theValue << " )";
167 //=============================================================================
169 * BLSURFPlugin_Hypothesis_i::GetPhySize
173 //=============================================================================
174 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhySize()
177 return this->GetImpl()->GetPhySize();
180 //=============================================================================
182 * BLSURFPlugin_Hypothesis_i::IsPhySizeRel
184 * Returns True if PhySize is relative
186 //=============================================================================
187 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsPhySizeRel()
190 return this->GetImpl()->IsPhySizeRel();
193 //=============================================================================
194 void BLSURFPlugin_Hypothesis_i::SetMinSize(CORBA::Double theMinSize)
196 if (IsMinSizeRel() || GetMinSize() != theMinSize ) {
197 this->GetImpl()->SetMinSize(theMinSize, false);
198 SMESH::TPythonDump() << _this() << ".SetMinSize( " << theMinSize << " )";
202 //=============================================================================
203 void BLSURFPlugin_Hypothesis_i::SetMinSizeRel(CORBA::Double theMinSize)
205 if ( !IsMinSizeRel() || (GetMinSize() != theMinSize) ) {
206 this->GetImpl()->SetMinSize(theMinSize, true);
207 SMESH::TPythonDump() << _this() << ".SetMinSizeRel( " << theMinSize << " )";
211 //=============================================================================
212 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMinSize()
214 return this->GetImpl()->GetMinSize();
217 //=============================================================================
218 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMinSizeRel()
220 return this->GetImpl()->IsMinSizeRel();
223 //=============================================================================
224 void BLSURFPlugin_Hypothesis_i::SetMaxSize(CORBA::Double theMaxSize)
226 if (IsMaxSizeRel() || GetMaxSize() != theMaxSize) {
227 this->GetImpl()->SetMaxSize(theMaxSize, false);
228 SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theMaxSize << " )";
232 //=============================================================================
233 void BLSURFPlugin_Hypothesis_i::SetMaxSizeRel(CORBA::Double theMaxSize)
235 if ( !IsMaxSizeRel() || (GetMaxSize() != theMaxSize) ) {
236 this->GetImpl()->SetMaxSize(theMaxSize, true);
237 SMESH::TPythonDump() << _this() << ".SetMaxSizeRel( " << theMaxSize << " )";
241 //=============================================================================
242 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMaxSize()
244 return this->GetImpl()->GetMaxSize();
247 //=============================================================================
248 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMaxSizeRel()
250 return this->GetImpl()->IsMaxSizeRel();
254 //=============================================================================
256 * BLSURFPlugin_Hypothesis_i::SetUseGradation
260 //=============================================================================
261 void BLSURFPlugin_Hypothesis_i::SetUseGradation(CORBA::Boolean theValue)
263 if ( GetImpl()->GetUseGradation() != bool( theValue ))
265 this->GetImpl()->SetUseGradation(theValue);
266 std::string theValueStr = theValue ? "True" : "False";
267 SMESH::TPythonDump() << _this() << ".SetUseGradation( " << theValueStr.c_str() << " )";
271 //=============================================================================
273 * BLSURFPlugin_Hypothesis_i::GetUseGradation
277 //=============================================================================
278 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseGradation()
280 return this->GetImpl()->GetUseGradation();
283 //=============================================================================
285 * BLSURFPlugin_Hypothesis_i::SetGradation
289 //=============================================================================
290 void BLSURFPlugin_Hypothesis_i::SetGradation(CORBA::Double theValue)
292 this->GetImpl()->SetGradation(theValue);
295 SetUseGradation( false );
297 SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )";
300 //=============================================================================
302 * BLSURFPlugin_Hypothesis_i::GetGradation
306 //=============================================================================
307 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation()
309 return this->GetImpl()->GetGradation();
312 //=============================================================================
314 * BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation
318 //=============================================================================
319 void BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation(CORBA::Boolean theValue)
321 if ( GetImpl()->GetUseVolumeGradation() != bool( theValue ))
323 this->GetImpl()->SetUseVolumeGradation(theValue);
324 std::string theValueStr = theValue ? "True" : "False";
325 SMESH::TPythonDump() << _this() << ".SetUseVolumeGradation( " << theValueStr.c_str() << " )";
329 //=============================================================================
331 * BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation
335 //=============================================================================
336 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation()
338 return this->GetImpl()->GetUseVolumeGradation();
341 //=============================================================================
343 * BLSURFPlugin_Hypothesis_i::SetVolumeGradation
345 * Set VolumeGradation
347 //=============================================================================
348 void BLSURFPlugin_Hypothesis_i::SetVolumeGradation(CORBA::Double theValue)
350 this->GetImpl()->SetVolumeGradation(theValue);
352 SetUseVolumeGradation( false );
354 SMESH::TPythonDump() << _this() << ".SetVolumeGradation( " << theValue << " )";
357 //=============================================================================
359 * BLSURFPlugin_Hypothesis_i::GetVolumeGradation
361 * Get VolumeGradation
363 //=============================================================================
364 CORBA::Double BLSURFPlugin_Hypothesis_i::GetVolumeGradation()
366 return this->GetImpl()->GetVolumeGradation();
369 //=============================================================================
371 * BLSURFPlugin_Hypothesis_i::SetQuadAllowed
375 * DEPRACATED, kept for python script compatibility
377 * TO be removed in Salome 9
379 //=============================================================================
380 void BLSURFPlugin_Hypothesis_i::SetQuadAllowed(CORBA::Boolean theValue)
382 ::BLSURFPlugin_Hypothesis::ElementType theElementType = theValue ?
383 ::BLSURFPlugin_Hypothesis::QuadrangleDominant : ::BLSURFPlugin_Hypothesis::Triangles;
384 this->GetImpl()->SetElementType(theElementType);
385 SMESH::TPythonDump() << _this() << ".SetElementType( " << theElementType << " )";
388 //=============================================================================
390 * BLSURFPlugin_Hypothesis_i::SetElementType
394 //=============================================================================
395 void BLSURFPlugin_Hypothesis_i::SetElementType(CORBA::Long theValue)
397 this->GetImpl()->SetElementType((::BLSURFPlugin_Hypothesis::ElementType) theValue);
398 SMESH::TPythonDump() << _this() << ".SetElementType( " << theValue << " )";
400 //=============================================================================
402 * BLSURFPlugin_Hypothesis_i::GetElementType
406 //=============================================================================
407 CORBA::Long BLSURFPlugin_Hypothesis_i::GetElementType()
409 return this->GetImpl()->GetElementType();
412 //=============================================================================
414 * BLSURFPlugin_Hypothesis_i::SetAngleMesh
418 //=============================================================================
419 void BLSURFPlugin_Hypothesis_i::SetAngleMesh(CORBA::Double theValue)
421 this->GetImpl()->SetAngleMesh(theValue);
422 SMESH::TPythonDump() << _this() << ".SetAngleMesh( " << theValue << " )";
425 //=============================================================================
427 * BLSURFPlugin_Hypothesis_i::GetAngleMesh
431 //=============================================================================
432 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMesh()
434 return this->GetImpl()->GetAngleMesh();
437 //=============================================================================
439 * BLSURFPlugin_Hypothesis_i::SetChordalError
443 //=============================================================================
444 void BLSURFPlugin_Hypothesis_i::SetChordalError(CORBA::Double theValue)
446 this->GetImpl()->SetChordalError(theValue);
447 SMESH::TPythonDump() << _this() << ".SetChordalError( " << theValue << " )";
450 //=============================================================================
452 * BLSURFPlugin_Hypothesis_i::GetChordalError
456 //=============================================================================
457 CORBA::Double BLSURFPlugin_Hypothesis_i::GetChordalError()
459 return this->GetImpl()->GetChordalError();
462 //=============================================================================
464 * BLSURFPlugin_Hypothesis_i::SetAnisotropic
468 //=============================================================================
469 void BLSURFPlugin_Hypothesis_i::SetAnisotropic(CORBA::Boolean theValue)
471 this->GetImpl()->SetAnisotropic(theValue);
472 std::string theValueStr = theValue ? "True" : "False";
473 SMESH::TPythonDump() << _this() << ".SetAnisotropic( " << theValueStr.c_str() << " )";
476 //=============================================================================
478 * BLSURFPlugin_Hypothesis_i::GetAnisotropic
482 //=============================================================================
483 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetAnisotropic()
485 return this->GetImpl()->GetAnisotropic();
488 //=============================================================================
490 * BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio
492 * Set Anisotropic Ratio
494 //=============================================================================
495 void BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio(CORBA::Double theValue)
497 this->GetImpl()->SetAnisotropicRatio(theValue);
498 SMESH::TPythonDump() << _this() << ".SetAnisotropicRatio( " << theValue << " )";
501 //=============================================================================
503 * BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio
505 * Get Anisotropic Ratio
507 //=============================================================================
508 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio()
510 return this->GetImpl()->GetAnisotropicRatio();
514 //=============================================================================
516 * BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges
520 //=============================================================================
521 void BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges(CORBA::Boolean theValue) {
523 this->GetImpl()->SetRemoveTinyEdges(theValue);
524 std::string theValueStr = theValue ? "True" : "False";
525 SMESH::TPythonDump() << _this() << ".SetRemoveTinyEdges( " << theValueStr.c_str() << " )";
528 //=============================================================================
530 * BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges
534 //=============================================================================
535 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges() {
537 return this->GetImpl()->GetRemoveTinyEdges();
540 //=============================================================================
542 * BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength
544 * Set Tiny Edge Length
546 //=============================================================================
547 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength(CORBA::Double theValue) {
549 this->GetImpl()->SetTinyEdgeLength(theValue);
550 SMESH::TPythonDump() << _this() << ".SetTinyEdgeLength( " << theValue << " )";
553 //=============================================================================
555 * BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength
557 * Get Tiny Edge Length
559 //=============================================================================
560 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength() {
562 return this->GetImpl()->GetTinyEdgeLength();
565 //=============================================================================
567 * BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges
571 //=============================================================================
572 void BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges(CORBA::Boolean theValue) {
574 this->GetImpl()->SetOptimiseTinyEdges(theValue);
575 std::string theValueStr = theValue ? "True" : "False";
576 SMESH::TPythonDump() << _this() << ".SetOptimiseTinyEdges( " << theValueStr.c_str() << " )";
579 //=============================================================================
581 * BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges
585 //=============================================================================
586 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges() {
588 return this->GetImpl()->GetOptimiseTinyEdges();
591 //=============================================================================
593 * BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength
595 * Set Tiny Edge OptimisationLength
597 //=============================================================================
598 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength(CORBA::Double theValue) {
600 this->GetImpl()->SetTinyEdgeOptimisationLength(theValue);
601 SMESH::TPythonDump() << _this() << ".SetTinyEdgeOptimisationLength( " << theValue << " )";
604 //=============================================================================
606 * BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength
608 * Get Tiny Edge OptimisationLength
610 //=============================================================================
611 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength() {
613 return this->GetImpl()->GetTinyEdgeOptimisationLength();
616 //=============================================================================
618 * BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection
622 //=============================================================================
623 void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection(CORBA::Boolean theValue) {
625 this->GetImpl()->SetCorrectSurfaceIntersection(theValue);
626 std::string theValueStr = theValue ? "True" : "False";
627 SMESH::TPythonDump() << _this() << ".SetCorrectSurfaceIntersection( " << theValueStr.c_str() << " )";
630 //=============================================================================
632 * BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection
636 //=============================================================================
637 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection() {
639 return this->GetImpl()->GetCorrectSurfaceIntersection();
642 //=============================================================================
644 * BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost
646 * Set Tiny Edge OptimisationLength
648 //=============================================================================
649 void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost(CORBA::Double theValue) {
651 this->GetImpl()->SetCorrectSurfaceIntersectionMaxCost(theValue);
652 SMESH::TPythonDump() << _this() << ".SetCorrectSurfaceIntersectionMaxCost( " << theValue << " )";
655 //=============================================================================
657 * BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost
659 * Get Tiny Edge OptimisationLength
661 //=============================================================================
662 CORBA::Double BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost() {
664 return this->GetImpl()->GetCorrectSurfaceIntersectionMaxCost();
667 //=============================================================================
669 * BLSURFPlugin_Hypothesis_i::SetBadElementRemoval
673 //=============================================================================
674 void BLSURFPlugin_Hypothesis_i::SetBadElementRemoval(CORBA::Boolean theValue) {
676 this->GetImpl()->SetBadElementRemoval(theValue);
677 std::string theValueStr = theValue ? "True" : "False";
678 SMESH::TPythonDump() << _this() << ".SetBadElementRemoval( " << theValueStr.c_str() << " )";
681 //=============================================================================
683 * BLSURFPlugin_Hypothesis_i::GetBadElementRemoval
687 //=============================================================================
688 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetBadElementRemoval() {
690 return this->GetImpl()->GetBadElementRemoval();
693 //=============================================================================
695 * BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio
697 * Set Bad Surface Element Aspect Ratio
699 //=============================================================================
700 void BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio(CORBA::Double theValue) {
702 this->GetImpl()->SetBadElementAspectRatio(theValue);
703 SMESH::TPythonDump() << _this() << ".SetBadElementAspectRatio( " << theValue << " )";
706 //=============================================================================
708 * BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio
710 * Get Bad Surface Element Aspect Ratio
712 //=============================================================================
713 CORBA::Double BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio() {
715 return this->GetImpl()->GetBadElementAspectRatio();
718 //=============================================================================
720 * BLSURFPlugin_Hypothesis_i::SetOptimizeMesh
724 //=============================================================================
725 void BLSURFPlugin_Hypothesis_i::SetOptimizeMesh(CORBA::Boolean theValue) {
727 this->GetImpl()->SetOptimizeMesh(theValue);
728 std::string theValueStr = theValue ? "True" : "False";
729 SMESH::TPythonDump() << _this() << ".SetOptimizeMesh( " << theValueStr.c_str() << " )";
732 //=============================================================================
734 * BLSURFPlugin_Hypothesis_i::GetOptimizeMesh
738 //=============================================================================
739 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimizeMesh() {
741 return this->GetImpl()->GetOptimizeMesh();
744 //=============================================================================
746 * BLSURFPlugin_Hypothesis_i::SetQuadraticMesh
750 //=============================================================================
751 void BLSURFPlugin_Hypothesis_i::SetQuadraticMesh(CORBA::Boolean theValue) {
753 this->GetImpl()->SetQuadraticMesh(theValue);
754 std::string theValueStr = theValue ? "True" : "False";
755 SMESH::TPythonDump() << _this() << ".SetQuadraticMesh( " << theValueStr.c_str() << " )";
758 //=============================================================================
760 * BLSURFPlugin_Hypothesis_i::GetQuadraticMesh
764 //=============================================================================
765 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadraticMesh() {
767 return this->GetImpl()->GetQuadraticMesh();
775 * BLSURFPlugin_Hypothesis_i::SetTopology
780 //=============================================================================
781 void BLSURFPlugin_Hypothesis_i::SetTopology(CORBA::Long theValue) {
783 this->GetImpl()->SetTopology((::BLSURFPlugin_Hypothesis::Topology) theValue);
784 SMESH::TPythonDump() << _this() << ".SetTopology( " << theValue << " )";
787 //=============================================================================
789 * BLSURFPlugin_Hypothesis_i::GetTopology
793 //=============================================================================
794 CORBA::Long BLSURFPlugin_Hypothesis_i::GetTopology() {
796 return this->GetImpl()->GetTopology();
799 //=============================================================================
801 * Activate/deactivate surface proximity computation
803 void BLSURFPlugin_Hypothesis_i::SetSurfaceProximity( CORBA::Boolean toUse )
805 if ( GetSurfaceProximity() != toUse )
807 this->GetImpl()->SetUseSurfaceProximity( toUse );
808 SMESH::TPythonDump() << _this() << ".SetSurfaceProximity( " << toUse << " )";
812 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetSurfaceProximity()
814 return this->GetImpl()->GetUseSurfaceProximity();
817 //=============================================================================
819 * Set number of surface element layers to be generated due to surface proximity
821 void BLSURFPlugin_Hypothesis_i::SetNbSurfaceProximityLayers( CORBA::Short nbLayers )
823 if ( GetNbSurfaceProximityLayers() != nbLayers )
825 this->GetImpl()->SetNbSurfaceProximityLayers( nbLayers );
826 SMESH::TPythonDump() << _this() << ".SetNbSurfaceProximityLayers( " << nbLayers << " )";
830 CORBA::Short BLSURFPlugin_Hypothesis_i::GetNbSurfaceProximityLayers()
832 return (CORBA::Short) this->GetImpl()->GetNbSurfaceProximityLayers();
835 //=============================================================================
837 * Set coefficient by which size of element refined due to surface proximity is increased
839 void BLSURFPlugin_Hypothesis_i::SetSurfaceProximityRatio( CORBA::Double ratio )
841 if ( GetSurfaceProximityRatio() != ratio )
843 this->GetImpl()->SetSurfaceProximityRatio( ratio );
844 SMESH::TPythonDump() << _this() << ".SetSurfaceProximityRatio( " << ratio << " )";
848 CORBA::Double BLSURFPlugin_Hypothesis_i::GetSurfaceProximityRatio()
850 return this->GetImpl()->GetSurfaceProximityRatio();
853 //=============================================================================
855 * Activate/deactivate volume proximity computation
857 void BLSURFPlugin_Hypothesis_i::SetVolumeProximity( CORBA::Boolean toUse )
859 if ( GetVolumeProximity() != toUse )
861 this->GetImpl()->SetUseVolumeProximity( toUse );
862 SMESH::TPythonDump() << _this() << ".SetVolumeProximity( " << toUse << " )";
866 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetVolumeProximity()
868 return this->GetImpl()->GetUseVolumeProximity();
872 //=============================================================================
874 * Set number of surface element layers to be generated due to volume proximity
876 void BLSURFPlugin_Hypothesis_i::SetNbVolumeProximityLayers( CORBA::Short nbLayers )
878 if ( GetNbVolumeProximityLayers() != nbLayers )
880 this->GetImpl()->SetNbVolumeProximityLayers( nbLayers );
881 SMESH::TPythonDump() << _this() << ".SetNbVolumeProximityLayers( " << nbLayers << " )";
885 CORBA::Short BLSURFPlugin_Hypothesis_i::GetNbVolumeProximityLayers()
887 return (CORBA::Short) this->GetImpl()->GetNbVolumeProximityLayers();
890 //=============================================================================
892 * Set coefficient by which size of element refined due to volume proximity is increased
894 void BLSURFPlugin_Hypothesis_i::SetVolumeProximityRatio( CORBA::Double ratio )
896 if ( GetVolumeProximityRatio() != ratio )
898 this->GetImpl()->SetVolumeProximityRatio( ratio );
899 SMESH::TPythonDump() << _this() << ".SetVolumeProximityRatio( " << ratio << " )";
903 CORBA::Double BLSURFPlugin_Hypothesis_i::GetVolumeProximityRatio()
905 return this->GetImpl()->GetVolumeProximityRatio();
908 //=============================================================================
909 void BLSURFPlugin_Hypothesis_i::SetVerbosity(CORBA::Short theVal) {
911 if (theVal < 0 || theVal > 100)
912 THROW_SALOME_CORBA_EXCEPTION( "Invalid verbosity level",SALOME::BAD_PARAM );
913 this->GetImpl()->SetVerbosity(theVal);
914 SMESH::TPythonDump() << _this() << ".SetVerbosity( " << theVal << " )";
917 //=============================================================================
919 CORBA::Short BLSURFPlugin_Hypothesis_i::GetVerbosity() {
921 return (CORBA::Short) this->GetImpl()->GetVerbosity();
924 //=============================================================================
925 void BLSURFPlugin_Hypothesis_i::SetEnforceCadEdgesSize( CORBA::Boolean toEnforce )
927 if ( GetEnforceCadEdgesSize() != toEnforce )
929 this->GetImpl()->SetEnforceCadEdgesSize(toEnforce);
930 SMESH::TPythonDump() << _this() << ".SetEnforceCadEdgesSize( " << toEnforce << " )";
933 //=============================================================================
934 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetEnforceCadEdgesSize()
936 return this->GetImpl()->GetEnforceCadEdgesSize();
938 //=============================================================================
940 void BLSURFPlugin_Hypothesis_i::SetJacobianRectificationRespectGeometry( CORBA::Boolean allowRectification )
942 if ( GetJacobianRectificationRespectGeometry() != allowRectification )
944 this->GetImpl()->SetJacobianRectificationRespectGeometry(allowRectification);
945 SMESH::TPythonDump() << _this() << ".SetJacobianRectificationRespectGeometry( " << allowRectification << " )";
948 //=============================================================================
949 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetJacobianRectificationRespectGeometry()
951 return this->GetImpl()->GetJacobianRectificationRespectGeometry();
953 //=============================================================================
955 void BLSURFPlugin_Hypothesis_i::SetJacobianRectification( CORBA::Boolean allowRectification )
957 if ( GetJacobianRectification() != allowRectification )
959 this->GetImpl()->SetJacobianRectification(allowRectification);
960 SMESH::TPythonDump() << _this() << ".SetJacobianRectification( " << allowRectification << " )";
963 //=============================================================================
964 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetJacobianRectification()
966 return this->GetImpl()->GetJacobianRectification();
968 //=============================================================================
970 void BLSURFPlugin_Hypothesis_i::SetUseDeprecatedPatchMesher( CORBA::Boolean useDeprecatedPatchMesher )
972 if ( GetUseDeprecatedPatchMesher() != useDeprecatedPatchMesher )
974 this->GetImpl()->SetUseDeprecatedPatchMesher(useDeprecatedPatchMesher);
975 SMESH::TPythonDump() << _this() << ".SetUseDeprecatedPatchMesher( " << useDeprecatedPatchMesher << " )";
978 //=============================================================================
979 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseDeprecatedPatchMesher()
981 return this->GetImpl()->GetUseDeprecatedPatchMesher();
983 //=============================================================================
985 void BLSURFPlugin_Hypothesis_i::SetMaxNumberOfPointsPerPatch( CORBA::Long nb )
987 if ( GetMaxNumberOfPointsPerPatch() != nb )
990 this->GetImpl()->SetMaxNumberOfPointsPerPatch(nb);
992 } catch (const std::invalid_argument& ex) {
993 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
994 } catch (SALOME_Exception& ex) {
995 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
997 SMESH::TPythonDump() << _this() << ".SetMaxNumberOfPointsPerPatch( " << nb << " )";
1000 //=============================================================================
1001 CORBA::Long BLSURFPlugin_Hypothesis_i::GetMaxNumberOfPointsPerPatch()
1003 return this->GetImpl()->GetMaxNumberOfPointsPerPatch();
1005 //=============================================================================
1007 void BLSURFPlugin_Hypothesis_i::SetMaxNumberOfThreads( CORBA::Long nb )
1009 if ( GetMaxNumberOfThreads() != nb )
1012 this->GetImpl()->SetMaxNumberOfThreads(nb);
1014 } catch (const std::invalid_argument& ex) {
1015 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1016 } catch (SALOME_Exception& ex) {
1017 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1019 SMESH::TPythonDump() << _this() << ".SetMaxNumberOfThreads( " << nb << " )";
1022 //=============================================================================
1023 CORBA::Long BLSURFPlugin_Hypothesis_i::GetMaxNumberOfThreads()
1025 return this->GetImpl()->GetMaxNumberOfThreads();
1027 //=============================================================================
1029 void BLSURFPlugin_Hypothesis_i::SetRespectGeometry( CORBA::Boolean toRespect )
1031 if ( GetRespectGeometry() != toRespect )
1033 this->GetImpl()->SetRespectGeometry(toRespect);
1034 SMESH::TPythonDump() << _this() << ".SetRespectGeometry( " << toRespect << " )";
1037 //=============================================================================
1038 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRespectGeometry()
1040 return this->GetImpl()->GetRespectGeometry();
1042 //=============================================================================
1044 void BLSURFPlugin_Hypothesis_i::SetTinyEdgesAvoidSurfaceIntersections( CORBA::Boolean toAvoidIntersection )
1046 if ( GetTinyEdgesAvoidSurfaceIntersections() != toAvoidIntersection )
1048 this->GetImpl()->SetTinyEdgesAvoidSurfaceIntersections(toAvoidIntersection);
1049 SMESH::TPythonDump() << _this() << ".SetTinyEdgesAvoidSurfaceIntersections( " << toAvoidIntersection << " )";
1052 //=============================================================================
1053 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetTinyEdgesAvoidSurfaceIntersections()
1055 return this->GetImpl()->GetTinyEdgesAvoidSurfaceIntersections();
1057 //=============================================================================
1059 void BLSURFPlugin_Hypothesis_i::SetClosedGeometry( CORBA::Boolean isClosed )
1061 if ( GetClosedGeometry() != isClosed )
1063 this->GetImpl()->SetClosedGeometry(isClosed);
1064 SMESH::TPythonDump() << _this() << ".SetClosedGeometry( " << isClosed << " )";
1067 //=============================================================================
1068 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetClosedGeometry()
1070 return this->GetImpl()->GetClosedGeometry();
1072 //=============================================================================
1074 void BLSURFPlugin_Hypothesis_i::SetDebug( CORBA::Boolean isDebug )
1076 if ( GetDebug() != isDebug )
1078 this->GetImpl()->SetDebug(isDebug);
1079 SMESH::TPythonDump() << _this() << ".SetDebug( " << isDebug << " )";
1082 //=============================================================================
1083 bool BLSURFPlugin_Hypothesis_i::GetDebug()
1085 return this->GetImpl()->GetDebug();
1087 //=============================================================================
1089 void BLSURFPlugin_Hypothesis_i::SetPeriodicTolerance( CORBA::Double tol )
1092 if ( GetImpl()->GetPreCADOptionValue("periodic_tolerance",&isDefault) != SMESH_Comment( tol ))
1096 this->GetImpl()->SetPeriodicTolerance(tol);
1098 } catch (const std::invalid_argument& ex) {
1099 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1100 } catch (SALOME_Exception& ex) {
1101 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1103 SMESH::TPythonDump() << _this() << ".SetPeriodicTolerance( " << tol << " )";
1106 //=============================================================================
1107 double BLSURFPlugin_Hypothesis_i::GetPeriodicTolerance()
1110 return this->GetImpl()->GetPeriodicTolerance();
1112 } catch (const std::invalid_argument& ex) {
1113 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1114 } catch (SALOME_Exception& ex) {
1115 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1119 //=============================================================================
1121 void BLSURFPlugin_Hypothesis_i::SetRequiredEntities( const char* howToTreat )
1123 if ( GetImpl()->GetRequiredEntities() != howToTreat )
1126 this->GetImpl()->SetRequiredEntities(howToTreat);
1128 } catch (const std::invalid_argument& ex) {
1129 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1130 } catch (SALOME_Exception& ex) {
1131 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1133 SMESH::TPythonDump() << _this() << ".SetRequiredEntities( '" << howToTreat << "' )";
1136 //=============================================================================
1137 char* BLSURFPlugin_Hypothesis_i::GetRequiredEntities()
1139 return CORBA::string_dup( this->GetImpl()->GetRequiredEntities().c_str() );
1141 //=============================================================================
1143 void BLSURFPlugin_Hypothesis_i::SetSewingTolerance( CORBA::Double tol )
1146 if ( GetImpl()->GetPreCADOptionValue("sewing_tolerance",&isDefault) != SMESH_Comment( tol ))
1150 this->GetImpl()->SetSewingTolerance(tol);
1151 SMESH::TPythonDump() << _this() << ".SetSewingTolerance( " << tol << " )";
1153 } catch (const std::invalid_argument& ex) {
1154 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1155 } catch (SALOME_Exception& ex) {
1156 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1160 //=============================================================================
1161 CORBA::Double BLSURFPlugin_Hypothesis_i::GetSewingTolerance()
1165 return this->GetImpl()->GetSewingTolerance();
1167 } catch (const std::invalid_argument& ex) {
1168 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1169 } catch (SALOME_Exception& ex) {
1170 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1174 //=============================================================================
1176 void BLSURFPlugin_Hypothesis_i::SetTags( const char* howToTreat )
1178 if ( GetImpl()->GetTags() != howToTreat )
1181 this->GetImpl()->SetTags(howToTreat);
1183 catch (const std::invalid_argument& ex) {
1184 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1185 } catch (SALOME_Exception& ex) {
1186 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1189 SMESH::TPythonDump() << _this() << ".SetTags( '" << howToTreat << "' )";
1191 //=============================================================================
1192 char* BLSURFPlugin_Hypothesis_i::GetTags()
1194 return CORBA::string_dup( this->GetImpl()->GetTags().c_str() );
1197 //=============================================================================
1198 void BLSURFPlugin_Hypothesis_i::SetHyperPatches(const BLSURFPlugin::THyperPatchList& hpl)
1200 ::BLSURFPlugin_Hypothesis::THyperPatchList patchList( hpl.length() );
1201 SMESH_Comment hplDump;
1203 for ( CORBA::ULong i = 0; i < patchList.size(); ++i )
1206 BLSURFPlugin::THyperPatch tags = hpl[ i ];
1207 for ( CORBA::ULong j = 0; j < tags.length(); ++j )
1209 patchList[ i ].insert( tags[ j ]);
1210 hplDump << tags[ j ] << ( j+1 < tags.length() ? ", " : " ]" );
1212 hplDump << ( i+1 < patchList.size() ? "," : "]");
1214 if ( GetImpl()->GetHyperPatches() != patchList )
1216 GetImpl()->SetHyperPatches( ::BLSURFPlugin_Hypothesis::THyperPatchEntriesList() ); // erase entries
1217 GetImpl()->SetHyperPatches( patchList );
1218 SMESH::TPythonDump() << _this() << ".SetHyperPatches( " << hplDump << " )";
1222 //=============================================================================
1223 void BLSURFPlugin_Hypothesis_i::SetHyperPatchEntries(const BLSURFPlugin::THyperPatchEntriesList& hpe)
1225 ::BLSURFPlugin_Hypothesis::THyperPatchEntriesList patchList( hpe.length() );
1226 SMESH_Comment hpeDump;
1228 for ( CORBA::ULong i = 0; i < patchList.size(); ++i )
1231 const BLSURFPlugin::THyperPatchEntries& entryList = hpe[ i ];
1232 for ( CORBA::ULong j = 0; j < entryList.length(); ++j )
1234 patchList[ i ].insert( entryList[ j ].in() );
1235 hpeDump << entryList[ j ].in() << ( j+1 < entryList.length() ? ", " : " ]" );
1237 hpeDump << ( i+1 < patchList.size() ? "," : "]");
1239 if ( GetImpl()->GetHyperPatchEntries() != patchList )
1241 GetImpl()->SetHyperPatches( ::BLSURFPlugin_Hypothesis::THyperPatchList(), /*notify=*/false );
1242 GetImpl()->SetHyperPatches( patchList );
1243 // TPythonDump converts entries to objects
1244 SMESH::TPythonDump() << _this() << ".SetHyperPatchShapes( " << hpeDump << " )";
1248 //=============================================================================
1249 void BLSURFPlugin_Hypothesis_i::SetHyperPatchShapes(const BLSURFPlugin::THyperPatchShapesList& hpsl)
1251 BLSURFPlugin::THyperPatchEntriesList patchList;
1252 patchList.length( hpsl.length() );
1253 for ( CORBA::ULong i = 0; i < hpsl.length(); ++i )
1255 const GEOM::ListOfGO& shapeList = hpsl[ i ];
1256 BLSURFPlugin::THyperPatchEntries& entryList = patchList[ i ];
1257 entryList.length( shapeList.length() );
1258 for ( CORBA::ULong j = 0; j < shapeList.length(); ++j )
1260 CORBA::String_var entry = shapeList[ j ]->GetStudyEntry();
1261 if ( !entry.in() || !entry.in()[0] )
1262 THROW_SALOME_CORBA_EXCEPTION( "BLSURFPlugin_Hypothesis::SetHyperPatchShapes(), "
1263 "Not published hyper-patch shape", SALOME::BAD_PARAM );
1264 entryList[ j ] = CORBA::string_dup( entry );
1267 this->SetHyperPatchEntries( patchList );
1270 //=============================================================================
1271 BLSURFPlugin::THyperPatchList*
1272 BLSURFPlugin_Hypothesis_i::GetHyperPatches( GEOM::GEOM_Object_ptr mainShape )
1274 const ::BLSURFPlugin_Hypothesis::THyperPatchList& hpl = GetImpl()->GetHyperPatches();
1275 BLSURFPlugin::THyperPatchList* resHpl = new BLSURFPlugin::THyperPatchList();
1277 !CORBA::is_nil( mainShape ) &&
1278 !GetImpl()->GetHyperPatchEntries().empty() )
1280 // set IDs by entries
1281 SMESH_Gen_i* smeshGen = SMESH_Gen_i::GetSMESHGen();
1282 TopoDS_Shape S = smeshGen->GeomObjectToShape( mainShape );
1285 std::map< std::string, TopoDS_Shape > entryToShape;
1286 BLSURFPlugin_BLSURF::FillEntryToShape( GetImpl(), entryToShape );
1287 GetImpl()->SetHyperPatchIDsByEntry( S, entryToShape );
1290 resHpl->length((CORBA::ULong) hpl.size() );
1292 ::BLSURFPlugin_Hypothesis::THyperPatchList::const_iterator hpIt = hpl.begin();
1293 for ( int i = 0; hpIt != hpl.end(); ++hpIt, ++i )
1295 const ::BLSURFPlugin_Hypothesis::THyperPatchTags& hp = *hpIt;
1296 BLSURFPlugin::THyperPatch& resHp = (*resHpl)[ i ];
1297 resHp.length((CORBA::ULong) hp.size() );
1299 ::BLSURFPlugin_Hypothesis::THyperPatchTags::const_iterator tag = hp.begin();
1300 for ( int j = 0; tag != hp.end(); ++tag, ++j )
1306 //=============================================================================
1307 BLSURFPlugin::THyperPatchEntriesList* BLSURFPlugin_Hypothesis_i::GetHyperPatchShapes()
1309 const ::BLSURFPlugin_Hypothesis::THyperPatchEntriesList& hpel = GetImpl()->GetHyperPatchEntries();
1310 BLSURFPlugin::THyperPatchEntriesList* resHpl = new BLSURFPlugin::THyperPatchEntriesList();
1311 resHpl->length((CORBA::ULong) hpel.size() );
1313 ::BLSURFPlugin_Hypothesis::THyperPatchEntriesList::const_iterator hpIt = hpel.begin();
1314 for ( int i = 0; hpIt != hpel.end(); ++hpIt, ++i )
1316 const ::BLSURFPlugin_Hypothesis::THyperPatchEntries& hp = *hpIt;
1317 BLSURFPlugin::THyperPatchEntries& resHp = (*resHpl)[ i ];
1318 resHp.length((CORBA::ULong) hp.size() );
1320 ::BLSURFPlugin_Hypothesis::THyperPatchEntries::const_iterator entry = hp.begin();
1321 for ( int j = 0; entry != hp.end(); ++entry, ++j )
1322 resHp[ j ] = CORBA::string_dup( entry->c_str() );
1327 //=============================================================================
1329 * BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges
1333 //=============================================================================
1334 void BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges(CORBA::Boolean theValue) {
1336 this->GetImpl()->SetPreCADMergeEdges(theValue);
1337 std::string theValueStr = theValue ? "True" : "False";
1338 SMESH::TPythonDump() << _this() << ".SetPreCADMergeEdges( " << theValueStr.c_str() << " )";
1341 //=============================================================================
1343 * BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges
1347 //=============================================================================
1348 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges() {
1350 return this->GetImpl()->GetPreCADMergeEdges();
1353 //=============================================================================
1355 * BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces
1359 //=============================================================================
1360 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue) {
1362 this->GetImpl()->SetPreCADRemoveDuplicateCADFaces(theValue);
1363 std::string theValueStr = theValue ? "True" : "False";
1364 SMESH::TPythonDump() << _this() << ".SetPreCADRemoveDuplicateCADFaces( " << theValueStr.c_str() << " )";
1367 //=============================================================================
1369 * BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces
1373 //=============================================================================
1374 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces() {
1376 return this->GetImpl()->GetPreCADRemoveDuplicateCADFaces();
1379 //=============================================================================
1381 * BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology
1385 //=============================================================================
1386 void BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology(CORBA::Boolean theValue) {
1388 this->GetImpl()->SetPreCADProcess3DTopology(theValue);
1389 std::string theValueStr = theValue ? "True" : "False";
1390 SMESH::TPythonDump() << _this() << ".SetPreCADProcess3DTopology( " << theValueStr.c_str() << " )";
1393 //=============================================================================
1395 * BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology
1399 //=============================================================================
1400 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology() {
1402 return this->GetImpl()->GetPreCADProcess3DTopology();
1405 //=============================================================================
1407 * BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput
1411 //=============================================================================
1412 void BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput(CORBA::Boolean theValue) {
1414 this->GetImpl()->SetPreCADDiscardInput(theValue);
1415 std::string theValueStr = theValue ? "True" : "False";
1416 SMESH::TPythonDump() << _this() << ".SetPreCADDiscardInput( " << theValueStr.c_str() << " )";
1419 //=============================================================================
1421 * BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput
1425 //=============================================================================
1426 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput() {
1428 return this->GetImpl()->GetPreCADDiscardInput();
1432 //=============================================================================
1434 void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
1438 std::string name( optionName );
1439 if ( !optionValue || !optionValue[0] )
1440 UnsetOption( optionName );
1442 // basic options (visible in Advanced table)
1444 else if ( name == "enforce_cad_edge_sizes" )
1445 SetEnforceCadEdgesSize( GetImpl()->ToBool( optionValue ));
1447 else if ( name == "jacobian_rectification_respect_geometry" )
1448 SetJacobianRectificationRespectGeometry( GetImpl()->ToBool( optionValue ));
1450 else if ( name == "max_number_of_points_per_patch" )
1451 SetMaxNumberOfPointsPerPatch( GetImpl()->ToInt( optionValue ));
1453 else if ( name == "max_number_of_threads" )
1454 SetMaxNumberOfThreads( GetImpl()->ToInt( optionValue ));
1456 else if ( name == "rectify_jacobian" )
1457 SetJacobianRectification( GetImpl()->ToBool( optionValue ));
1459 else if ( name == "use_deprecated_patch_mesher" )
1460 SetUseDeprecatedPatchMesher( GetImpl()->ToBool( optionValue ));
1462 else if ( name == "respect_geometry" )
1463 SetRespectGeometry( GetImpl()->ToBool( optionValue ));
1465 else if ( name == "tiny_edge_avoid_surface_intersections" )
1466 SetTinyEdgesAvoidSurfaceIntersections( GetImpl()->ToBool( optionValue ));
1468 else if ( name == "closed_geometry" )
1469 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1471 else if ( name == "debug" )
1472 SetDebug( GetImpl()->ToBool( optionValue ));
1474 else if ( name == "discard_input_topology" )
1475 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1477 else if ( name == "merge_edges" )
1478 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1480 else if ( name == "periodic_tolerance" )
1481 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1483 else if ( name == "remove_duplicate_cad_faces" )
1484 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1486 else if ( name == "required_entities" )
1487 SetRequiredEntities( optionValue );
1489 else if ( name == "sewing_tolerance" )
1490 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1492 else if ( name == "tags" )
1493 SetTags( optionValue );
1495 // other basic options with specific methods
1497 else if ( name == "correct_surface_intersections" )
1498 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1500 else if ( name == "optimise_tiny_edges" )
1501 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1503 else if ( name == "surface_intersections_processing_max_cost" )
1504 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1506 else if ( name == "volume_gradation" )
1507 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1509 else if ( name == "tiny_edge_optimisation_length" )
1510 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1512 else if ( name == "proximity" )
1513 SetVolumeProximity( GetImpl()->ToBool( optionValue ));
1515 else if ( name == "prox_ratio" )
1516 SetVolumeProximityRatio( GetImpl()->ToDbl( optionValue ));
1518 else if ( name == "prox_nb_layer" )
1519 SetNbVolumeProximityLayers((CORBA::Short) GetImpl()->ToInt( optionValue ));
1521 // advanced options (for backward compatibility)
1523 else if ( name == "create_tag_on_collision" ||
1524 name == "tiny_edge_respect_geometry" )
1525 AddOption( optionName, optionValue );
1529 valueChanged = ( this->GetImpl()->GetOptionValue( name ) != optionValue &&
1530 this->GetImpl()->GetOptionValue( name, &valueChanged ) != optionValue );
1533 this->GetImpl()->SetOptionValue(optionName, optionValue);
1534 SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
1537 } catch (const std::invalid_argument& ex) {
1538 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1539 } catch (SALOME_Exception& ex) {
1540 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1544 //=============================================================================
1546 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, const char* optionValue)
1549 bool valueChanged = false;
1551 std::string name( optionName );
1552 if ( !optionValue || !optionValue[0] )
1553 UnsetOption( optionName );
1555 else if ( name == "closed_geometry" )
1556 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1558 else if ( name == "debug" )
1559 SetDebug( GetImpl()->ToBool( optionValue ));
1561 else if ( name == "discard_input_topology" )
1562 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1564 else if ( name == "merge_edges" )
1565 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1567 else if ( name == "periodic_tolerance" )
1568 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1570 else if ( name == "remove_duplicate_cad_faces" )
1571 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1573 else if ( name == "required_entities" )
1574 SetRequiredEntities( optionValue );
1576 else if ( name == "sewing_tolerance" )
1577 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1579 else if ( name == "tags" )
1580 SetTags( optionValue );
1582 // other basic options with specific methods
1584 else if ( name == "correct_surface_intersections" )
1585 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1587 else if ( name == "optimise_tiny_edges" )
1588 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1590 else if ( name == "surface_intersections_processing_max_cost" )
1591 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1593 else if ( name == "volume_gradation" )
1594 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1596 else if ( name == "tiny_edge_optimisation_length" )
1597 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1599 else if ( name == "process_3d_topology" )
1600 SetPreCADProcess3DTopology( GetImpl()->ToBool( optionValue ));
1602 // advanced options (for backward compatibility)
1604 else if ( name == "create_tag_on_collision" ||
1605 name == "tiny_edge_respect_geometry" ||
1606 name == "remove_tiny_edges" ||
1607 name == "tiny_edge_length")
1608 AddPreCADOption( optionName, optionValue );
1611 valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue);
1613 this->GetImpl()->SetPreCADOptionValue(optionName, optionValue);
1615 } catch (const std::invalid_argument& ex) {
1616 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1617 } catch (SALOME_Exception& ex) {
1618 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1621 SMESH::TPythonDump() << _this() << ".SetPreCADOptionValue( '" << optionName << "', '" << optionValue << "' )";
1624 //=============================================================================
1626 char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName) {
1630 return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName,&isDefault).c_str());
1631 } catch (const std::invalid_argument& ex) {
1632 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1633 } catch (SALOME_Exception& ex) {
1634 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1639 //=============================================================================
1641 char* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValue(const char* optionName) {
1645 return CORBA::string_dup(this->GetImpl()->GetPreCADOptionValue(optionName,&isDefault).c_str());
1646 } catch (const std::invalid_argument& ex) {
1647 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1648 } catch (SALOME_Exception& ex) {
1649 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1654 //=============================================================================
1656 void BLSURFPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
1658 if ( !GetImpl()->GetOptionValue( optionName ).empty() )
1660 this->GetImpl()->ClearOption(optionName);
1661 SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
1665 //=============================================================================
1667 void BLSURFPlugin_Hypothesis_i::UnsetPreCADOption(const char* optionName) {
1669 if ( !GetImpl()->GetPreCADOptionValue( optionName ).empty() )
1671 this->GetImpl()->ClearPreCADOption(optionName);
1672 SMESH::TPythonDump() << _this() << ".UnsetPreCADOption( '" << optionName << "' )";
1676 //=============================================================================
1678 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() {
1680 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1682 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
1683 result->length((CORBA::ULong) opts.size());
1687 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1688 for (; opIt != opts.end(); ++opIt, ++i) {
1689 string name_value_type = opIt->first;
1690 if (!opIt->second.empty()) {
1691 name_value_type += ":";
1692 name_value_type += GetImpl()->GetOptionValue( opIt->first, &isDefault );
1693 name_value_type += isDefault ? ":0" : ":1";
1695 result[i] = CORBA::string_dup(name_value_type.c_str());
1698 return result._retn();
1701 //=============================================================================
1703 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() {
1705 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1707 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
1708 result->length((CORBA::ULong) opts.size());
1712 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1713 for (; opIt != opts.end(); ++opIt, ++i) {
1714 string name_value_type = opIt->first;
1715 if (!opIt->second.empty()) {
1716 name_value_type += ":";
1717 name_value_type += GetImpl()->GetPreCADOptionValue( opIt->first, &isDefault );
1718 name_value_type += isDefault ? ":0" : ":1";
1720 result[i] = CORBA::string_dup(name_value_type.c_str());
1722 return result._retn();
1725 //=============================================================================
1727 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAdvancedOptionValues()
1729 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1731 const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
1732 result->length((CORBA::ULong) custom_opts.size());
1735 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = custom_opts.begin();
1736 for (; opIt != custom_opts.end(); ++opIt, ++i) {
1737 string name_value_type = opIt->first;
1738 if (!opIt->second.empty()) {
1739 name_value_type += ":";
1740 name_value_type += opIt->second;
1741 name_value_type += ":1"; // user defined
1743 result[i] = CORBA::string_dup(name_value_type.c_str());
1745 return result._retn();
1748 //=============================================================================
1750 void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
1753 for (CORBA::ULong i = 0; i < options.length(); ++i) {
1754 string name_value_type = options[i].in();
1755 if(name_value_type.empty())
1757 size_t colonPos = name_value_type.find(':');
1759 if (colonPos == string::npos) // ':' not found
1760 name = name_value_type;
1762 name = name_value_type.substr(0, colonPos);
1763 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1764 string value_type = name_value_type.substr(colonPos + 1);
1765 colonPos = value_type.find(':');
1766 value = value_type.substr(0, colonPos);
1767 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1768 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1772 SetOptionValue(name.c_str(), value.c_str());
1776 //=============================================================================
1778 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string_array& options)
1781 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1782 string name_value_type = options[i].in();
1783 if(name_value_type.empty())
1785 size_t colonPos = name_value_type.find(':');
1787 if (colonPos == string::npos) // ':' not found
1788 name = name_value_type;
1790 name = name_value_type.substr(0, colonPos);
1791 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1792 string value_type = name_value_type.substr(colonPos + 1);
1793 colonPos = value_type.find(':');
1794 value = value_type.substr(0, colonPos);
1795 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1796 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1800 SetPreCADOptionValue(name.c_str(), value.c_str());
1804 //=============================================================================
1806 void BLSURFPlugin_Hypothesis_i::SetAdvancedOptionValues(const BLSURFPlugin::string_array& options)
1808 SMESH::TPythonDump dump;
1810 string optionsAndValues;
1811 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1812 string name_value_type = options[i].in();
1813 if(name_value_type.empty())
1815 size_t colonPos = name_value_type.find(':');
1817 if (colonPos == string::npos) // ':' not found
1818 name = name_value_type;
1820 name = name_value_type.substr(0, colonPos);
1821 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1822 string value_type = name_value_type.substr(colonPos + 1);
1823 colonPos = value_type.find(':');
1824 value = value_type.substr(0, colonPos);
1827 AddOption(name.c_str(), value.c_str());
1829 optionsAndValues += name + " " + value + " ";
1832 if ( !optionsAndValues.empty() )
1833 dump << _this() << ".SetAdvancedOptions( '" << optionsAndValues.c_str() << "' )";
1836 //=============================================================================
1838 void BLSURFPlugin_Hypothesis_i::SetAdvancedOption(const char* optionsAndValues)
1840 if ( !optionsAndValues ) return;
1842 SMESH::TPythonDump dump;
1844 std::istringstream strm( optionsAndValues );
1845 std::istream_iterator<std::string> sIt( strm ), sEnd;
1846 while ( sIt != sEnd )
1848 std::string option = *sIt;
1849 if ( ++sIt != sEnd )
1851 std::string value = *sIt;
1853 AddOption( option.c_str(), value.c_str() );
1857 THROW_SALOME_CORBA_EXCEPTION( "Uneven number of options and values" ,SALOME::BAD_PARAM );
1860 dump << _this() << ".SetAdvancedOption( '" << optionsAndValues << "' )";
1863 //=============================================================================
1865 void BLSURFPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
1867 // backward compatibility
1869 std::string name( optionName );
1870 if ( name == "proximity" )
1871 SetVolumeProximity( GetImpl()->ToBool( optionValue ));
1873 else if ( name == "prox_ratio" )
1874 SetVolumeProximityRatio( GetImpl()->ToDbl( optionValue ));
1876 else if ( name == "prox_nb_layer" )
1877 SetNbVolumeProximityLayers( (CORBA::Short) GetImpl()->ToInt( optionValue ));
1879 bool valueChanged = (this->GetImpl()->GetOption(optionName) != optionValue);
1881 this->GetImpl()->AddOption(optionName, optionValue);
1882 SMESH::TPythonDump() << _this() << ".AddOption( '" << optionName << "', '" << optionValue << "' )";
1886 //=============================================================================
1888 void BLSURFPlugin_Hypothesis_i::AddPreCADOption(const char* optionName, const char* optionValue)
1891 bool valueChanged = (this->GetImpl()->GetPreCADOption(optionName) != optionValue);
1893 this->GetImpl()->AddPreCADOption(optionName, optionValue);
1894 SMESH::TPythonDump() << _this() << ".AddPreCADOption( '" << optionName << "', '" << optionValue << "' )";
1898 //=============================================================================
1900 char* BLSURFPlugin_Hypothesis_i::GetOption(const char* optionName)
1903 return CORBA::string_dup(this->GetImpl()->GetOption(optionName).c_str());
1906 //=============================================================================
1908 char* BLSURFPlugin_Hypothesis_i::GetPreCADOption(const char* optionName)
1911 return CORBA::string_dup(this->GetImpl()->GetPreCADOption(optionName).c_str());
1914 //=============================================================================
1916 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
1919 if ( !entry || !entry[0] )
1920 THROW_SALOME_CORBA_EXCEPTION( "SetSizeMapEntry(): empty geom entry", SALOME::BAD_PARAM );
1921 bool valueChanged = false;
1923 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap);
1925 this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
1926 } catch (const std::invalid_argument& ex) {
1927 SALOME::ExceptionStruct ExDescription;
1928 ExDescription.text = ex.what();
1929 ExDescription.type = SALOME::BAD_PARAM;
1930 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1931 ExDescription.lineNumber = 0;
1932 throw SALOME::SALOME_Exception(ExDescription);
1933 } catch (SALOME_Exception& ex) {
1934 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1937 SMESH::TPythonDump() << _this() << ".SetSizeMap(" << entry << ", '" << sizeMap << "' )";
1940 //=============================================================================
1942 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap)
1945 bool valueChanged = false;
1946 std::ostringstream sizeMapFunction;
1947 switch (shapeType) {
1948 case GEOM::FACE: sizeMapFunction << "def f(u,v): return " << sizeMap ; break;
1949 case GEOM::EDGE: sizeMapFunction << "def f(t): return " << sizeMap ; break;
1950 case GEOM::VERTEX: sizeMapFunction << "def f(): return " << sizeMap ; break;
1954 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str());
1956 this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str());
1957 } catch (const std::invalid_argument& ex) {
1958 SALOME::ExceptionStruct ExDescription;
1959 ExDescription.text = ex.what();
1960 ExDescription.type = SALOME::BAD_PARAM;
1961 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1962 ExDescription.lineNumber = 0;
1963 throw SALOME::SALOME_Exception(ExDescription);
1964 } catch (SALOME_Exception& ex) {
1965 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1968 SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", " << sizeMap << " )";
1971 //=============================================================================
1973 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
1976 bool valueChanged = false;
1978 valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
1979 if ( valueChanged ) {
1980 boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
1981 if (!boost::regex_match(string(attractor), re))
1982 throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
1983 this->GetImpl()->SetAttractorEntry(entry, attractor);
1985 } catch (const std::invalid_argument& ex) {
1986 SALOME::ExceptionStruct ExDescription;
1987 ExDescription.text = ex.what();
1988 ExDescription.type = SALOME::BAD_PARAM;
1989 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
1990 ExDescription.lineNumber = 0;
1991 throw SALOME::SALOME_Exception(ExDescription);
1992 } catch (SALOME_Exception& ex) {
1993 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1996 SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
1999 //=============================================================================
2001 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
2004 //bool valueChanged = false;
2006 this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
2008 catch (const std::invalid_argument& ex) {
2009 SALOME::ExceptionStruct ExDescription;
2010 ExDescription.text = ex.what();
2011 ExDescription.type = SALOME::BAD_PARAM;
2012 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
2013 ExDescription.lineNumber = 0;
2014 throw SALOME::SALOME_Exception(ExDescription);
2015 } catch (SALOME_Exception& ex) {
2016 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2018 //if ( valueChanged )
2019 SMESH::TPythonDump() << _this() << ".SetAttractorGeom( "
2020 << entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
2023 //=============================================================================
2025 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) {
2028 return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
2029 } catch (const std::invalid_argument& ex) {
2030 SALOME::ExceptionStruct ExDescription;
2031 ExDescription.text = ex.what();
2032 ExDescription.type = SALOME::BAD_PARAM;
2033 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
2034 ExDescription.lineNumber = 0;
2035 throw SALOME::SALOME_Exception(ExDescription);
2036 } catch (SALOME_Exception& ex) {
2037 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2042 //=============================================================================
2044 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) {
2047 return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
2048 } catch (const std::invalid_argument& ex) {
2049 SALOME::ExceptionStruct ExDescription;
2050 ExDescription.text = ex.what();
2051 ExDescription.type = SALOME::BAD_PARAM;
2052 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
2053 ExDescription.lineNumber = 0;
2054 throw SALOME::SALOME_Exception(ExDescription);
2055 } catch (SALOME_Exception& ex) {
2056 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2061 // //=============================================================================
2063 // // TODO coder cette fonction (utilis??e pour savoir si la valeur a chang??
2064 // // A finir pour le dump
2065 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
2067 // ASSERT(myBaseImpl);
2069 // return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
2071 // catch (const std::invalid_argument& ex) {
2072 // SALOME::ExceptionStruct ExDescription;
2073 // ExDescription.text = ex.what();
2074 // ExDescription.type = SALOME::BAD_PARAM;
2075 // ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
2076 // ExDescription.lineNumber = 0;
2077 // throw SALOME::SALOME_Exception(ExDescription);
2079 // catch (SALOME_Exception& ex) {
2080 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2085 //=============================================================================
2087 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
2089 this->GetImpl()->ClearEntry(entry);
2090 // SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
2093 //=============================================================================
2095 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
2097 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
2099 const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
2100 result->length((CORBA::ULong) sizeMaps.size());
2102 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
2103 for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
2104 string entry_sizemap = smIt->first;
2105 if (!smIt->second.empty()) {
2106 entry_sizemap += "|";
2107 entry_sizemap += smIt->second;
2109 result[i] = CORBA::string_dup(entry_sizemap.c_str());
2111 return result._retn();
2114 //=============================================================================
2116 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
2118 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
2120 const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
2121 result->length((CORBA::ULong) attractors.size());
2123 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
2124 for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
2125 string entry_attractor = atIt->first;
2126 if (!atIt->second.empty()) {
2127 entry_attractor += "|";
2128 entry_attractor += atIt->second;
2130 result[i] = CORBA::string_dup(entry_attractor.c_str());
2132 return result._retn();
2135 //=============================================================================
2137 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
2140 BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
2142 const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
2143 result->length((CORBA::ULong) attractors.size() );
2145 ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
2146 for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
2147 string faceEntry = atIt->first;
2149 double startSize=0., endSize=0., infDist=0., constDist=0.;
2150 if ( !atIt->second->Empty() ) {
2151 attEntry = atIt->second->GetAttractorEntry();
2152 std::vector<double> params = atIt->second->GetParameters();
2153 startSize = params[0];
2154 endSize = params[1];
2155 infDist = params[2];
2156 constDist = params[3];
2158 result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
2159 result[i].attEntry = CORBA::string_dup(attEntry.c_str());
2160 result[i].startSize = startSize;
2161 result[i].endSize = endSize;
2162 result[i].infDist = infDist;
2163 result[i].constDist = constDist;
2165 return result._retn();
2168 //=============================================================================
2170 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
2173 for ( CORBA::ULong i = 0; i < sizeMaps.length(); ++i) {
2174 string entry_sizemap = sizeMaps[i].in();
2175 size_t colonPos = entry_sizemap.find('|');
2176 string entry, sizemap;
2177 if (colonPos == string::npos) // '|' separator not found
2178 entry = entry_sizemap;
2180 entry = entry_sizemap.substr(0, colonPos);
2181 if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
2182 sizemap = entry_sizemap.substr(colonPos + 1);
2184 this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
2188 //=============================================================================
2190 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
2192 this->GetImpl()->ClearSizeMaps();
2195 //=============================================================================
2197 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
2201 entry = GeomObj->GetStudyEntry();
2202 SetSizeMapEntry(entry.c_str(), sizeMap);
2205 //=============================================================================
2207 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) {
2209 string entry = GeomObj->GetStudyEntry();
2210 GEOM::shape_type shapeType = GeomObj->GetShapeType();
2211 if (shapeType == GEOM::COMPOUND)
2212 shapeType = GeomObj->GetMaxShapeType();
2213 SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
2216 //=============================================================================
2217 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
2220 entry = GeomObj->GetStudyEntry();
2221 UnsetEntry(entry.c_str());
2222 SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
2225 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
2228 entry = GeomObj->GetStudyEntry();
2229 SetAttractorEntry(entry.c_str(), attractor);
2232 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
2235 entry = GeomObj->GetStudyEntry();
2236 UnsetEntry(entry.c_str());
2237 SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
2240 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)
2243 string theFaceEntry;
2245 theFaceEntry = theFace->GetStudyEntry();
2246 theAttEntry = theAttractor->GetStudyEntry();
2248 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2251 if (theFaceEntry.empty()) {
2253 aName += theFace->GetEntry();
2254 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2255 if (!theSFace->_is_nil())
2256 theFaceEntry = theSFace->GetID();
2258 if (theFaceEntry.empty())
2259 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2261 if (theAttEntry.empty()) {
2262 if (theAttractor->GetShapeType() == GEOM::VERTEX)
2264 if (theAttractor->GetShapeType() == GEOM::EDGE)
2266 if (theAttractor->GetShapeType() == GEOM::WIRE)
2268 if (theAttractor->GetShapeType() == GEOM::COMPOUND)
2269 aName = "Compound_";
2270 aName += theAttractor->GetEntry();
2271 SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(NULL, theAttractor, aName.c_str());
2272 if (!theSAtt->_is_nil())
2273 theAttEntry = theSAtt->GetID();
2275 if (theAttEntry.empty())
2276 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2278 TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
2279 TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
2280 SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
2283 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
2284 GEOM::GEOM_Object_ptr theAttractor)
2287 CORBA::String_var theFaceEntry = theFace->GetStudyEntry();
2288 CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
2290 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2293 // if (theFaceEntry.empty()) {
2295 // aName += theFace->GetEntry();
2296 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2297 // if (!theSFace->_is_nil())
2298 // theFaceEntry = theSFace->GetID();
2300 if ( !theFaceEntry.in() || !theFaceEntry.in()[0] ||
2301 !theAttrEntry.in() || !theAttrEntry.in()[0] )
2302 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2304 GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
2305 SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
2306 << theFace << ", " << theAttractor << " )";
2309 void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry,
2310 const char* attractorEntry)
2312 GetImpl()->ClearEntry( faceEntry, attractorEntry );
2313 SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '"
2314 << faceEntry << "', '" << attractorEntry << "' )";
2319 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
2322 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
2325 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap )
2328 char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry)
2331 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
2334 this->GetImpl()->UnsetCustomSizeMap(entry);
2335 SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
2339 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
2344 // ///////////////////////
2345 // // ENFORCED VERTICES //
2346 // ///////////////////////
2350 * Returns the list of enforced vertices for a given Face entry
2351 * @return A map of Face entry / List of enforced vertices
2354 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
2357 BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
2359 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
2360 this->GetImpl()->_GetAllEnforcedVerticesByFace();
2361 resultMap->length((CORBA::ULong) faceEntryEnfVertexListMap.size());
2363 ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
2364 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
2365 for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
2366 BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
2367 new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
2368 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2370 _enfVertexList = it_entry->second;
2371 BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
2372 enfVertexList->length((CORBA::ULong) _enfVertexList.size());
2374 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
2375 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2376 for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
2377 currentEnfVertex = (*it_enfVertex);
2379 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2382 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2385 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2388 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2389 coords->length((CORBA::ULong) currentEnfVertex->coords.size());
2390 for (CORBA::ULong i=0;i<coords->length();i++)
2391 coords[i] = currentEnfVertex->coords[i];
2392 enfVertex->coords = coords;
2395 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2398 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2399 faceEntryList->length((CORBA::ULong) currentEnfVertex->faceEntries.size());
2400 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2401 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2402 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2403 enfVertex->faceEntries = faceEntryList;
2406 msg << "Enforced vertex: \n"
2407 << "Name: " << enfVertex->name << "\n";
2408 if (coords->length())
2409 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2410 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2411 << "Group Name: " << enfVertex->grpName;
2413 enfVertexList[j] = enfVertex;
2415 mapElement->enfVertexList = enfVertexList;
2417 resultMap[i] = mapElement;
2420 return resultMap._retn();
2424 * Returns the list of all enforced vertices
2425 * @return a list of enforced vertices
2428 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
2430 BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
2431 const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
2432 resultMap->length((CORBA::ULong) enfVertexList.size());
2434 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
2435 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2436 for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
2437 currentEnfVertex = (*evlIt);
2438 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2440 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2442 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2444 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2445 coords->length((CORBA::ULong) currentEnfVertex->coords.size());
2446 for (CORBA::ULong ind = 0; ind < coords->length(); ind++)
2447 coords[ind] = currentEnfVertex->coords[ind];
2448 enfVertex->coords = coords;
2450 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2452 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2453 faceEntryList->length((CORBA::ULong) currentEnfVertex->faceEntries.size());
2454 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2455 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2456 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2457 enfVertex->faceEntries = faceEntryList;
2460 msg << "Enforced vertex: \n"
2461 << "Name: " << enfVertex->name << "\n";
2462 if (coords->length())
2463 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2464 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2465 << "Group Name: " << enfVertex->grpName;
2467 resultMap[i] = enfVertex;
2469 return resultMap._retn();
2474 * Returns the list of enforced vertices coords for a given Face entry.
2475 * They are the coords of the "manual" enforced vertices.
2476 * @return A map of Face entry / List of enforced vertices coords
2479 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
2482 BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
2484 const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
2485 resultMap->length((CORBA::ULong) entryCoordsListMap.size());
2487 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
2488 ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
2489 for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
2490 BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
2491 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2493 _coordsList = it_entry->second;
2494 BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
2495 coordsList->length((CORBA::ULong) _coordsList.size());
2497 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
2498 for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
2499 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2500 coords->length((CORBA::ULong) (*it_coords).size());
2501 for (CORBA::ULong i=0;i<coords->length();i++)
2502 coords[i] = (*it_coords)[i];
2503 coordsList[j] = coords;
2505 mapElement->coordsList = coordsList;
2507 resultMap[i] = mapElement;
2510 return resultMap._retn();
2514 * Returns a map of enforced vertices coords / enforced vertex.
2515 * They are the coords of the "manual" enforced vertices.
2517 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
2520 BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
2521 const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
2522 this->GetImpl()->_GetAllEnforcedVerticesByCoords();
2523 resultMap->length((CORBA::ULong) coordsEnfVertexMap.size());
2525 ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
2526 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2527 for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
2528 currentEnfVertex = (it_coords->second);
2529 BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
2530 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2531 coords->length((CORBA::ULong) it_coords->first.size());
2532 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2533 coords[ind] = it_coords->first[ind];
2534 mapElement->coords = coords;
2536 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2538 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2540 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2542 BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
2543 coords2->length((CORBA::ULong) currentEnfVertex->coords.size());
2544 for (CORBA::ULong ind=0;ind<coords2->length();ind++)
2545 coords2[ind] = currentEnfVertex->coords[ind];
2546 enfVertex->coords = coords2;
2548 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2550 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2551 faceEntryList->length((CORBA::ULong) currentEnfVertex->faceEntries.size());
2552 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2553 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2554 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2555 enfVertex->faceEntries = faceEntryList;
2557 mapElement->enfVertex = enfVertex;
2559 msg << "Enforced vertex: \n"
2560 << "Name: " << enfVertex->name << "\n";
2561 if (coords->length())
2562 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2563 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2564 << "Group Name: " << enfVertex->grpName;
2566 resultMap[i] = mapElement;
2568 return resultMap._retn();
2572 * Returns the list of enforced vertices entries for a given Face entry.
2573 * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
2574 * @return A map of Face entry / List of enforced vertices geom entries
2577 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
2580 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
2582 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
2583 this->GetImpl()->_GetAllEnfVertexEntriesByFace();
2584 resultMap->length((CORBA::ULong) entryEnfVertexEntryListMap.size());
2586 ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
2587 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
2588 entryEnfVertexEntryListMap.begin();
2589 for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
2590 BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
2591 new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
2592 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2594 _enfVertexEntryList = it_entry->second;
2595 BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
2596 enfVertexEntryList->length((CORBA::ULong) _enfVertexEntryList.size());
2598 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
2599 for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
2600 enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
2602 mapElement->enfVertexEntryList = enfVertexEntryList;
2604 resultMap[i] = mapElement;
2607 return resultMap._retn();
2611 * Returns a map of enforced vertices geom entry / enforced vertex.
2612 * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
2614 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
2617 BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
2618 const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
2619 this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
2620 resultMap->length((CORBA::ULong) enfVertexEntryEnfVertexMap.size());
2622 ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
2623 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2624 for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
2625 currentEnfVertex = it_enfVertexEntry->second;
2626 BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
2627 mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
2629 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2631 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2633 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2635 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2636 coords->length((CORBA::ULong) currentEnfVertex->coords.size());
2637 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2638 coords[ind] = currentEnfVertex->coords[ind];
2639 enfVertex->coords = coords;
2641 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2643 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2644 faceEntryList->length((CORBA::ULong) currentEnfVertex->faceEntries.size());
2645 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2646 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2647 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2648 enfVertex->faceEntries = faceEntryList;
2651 msg << "Enforced vertex: \n"
2652 << "Name: " << enfVertex->name << "\n";
2653 if (coords->length())
2654 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2655 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2656 << "Group Name: " << enfVertex->grpName;
2658 mapElement->enfVertex = enfVertex;
2659 resultMap[i] = mapElement;
2661 return resultMap._retn();
2665 * Erase all enforced vertices
2667 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
2669 this->GetImpl()->ClearAllEnforcedVertices();
2670 SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
2674 * Set/get/unset an enforced vertex on face - OBSOLETE
2676 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2680 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2681 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2684 string theFaceEntry = theFace->GetStudyEntry();
2686 if (theFaceEntry.empty()) {
2687 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2689 if (theFace->GetShapeType() == GEOM::FACE)
2691 if (theFace->GetShapeType() == GEOM::COMPOUND)
2692 aName = "Compound_";
2693 aName += theFace->GetEntry();
2694 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2695 if (!theSFace->_is_nil())
2696 theFaceEntry = theSFace->GetID();
2698 if (theFaceEntry.empty())
2699 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2701 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2702 } catch (SALOME_Exception& ex) {
2703 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2708 * Set/get/unset an enforced vertex with name on face
2710 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2711 CORBA::Double z, const char* theVertexName) {
2714 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2715 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2718 string theFaceEntry = theFace->GetStudyEntry();
2720 if (theFaceEntry.empty()) {
2721 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2723 if (theFace->GetShapeType() == GEOM::FACE)
2725 if (theFace->GetShapeType() == GEOM::COMPOUND)
2726 aName = "Compound_";
2727 aName += theFace->GetEntry();
2728 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2729 if (!theSFace->_is_nil())
2730 theFaceEntry = theSFace->GetID();
2732 if (theFaceEntry.empty())
2733 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2736 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
2737 } catch (SALOME_Exception& ex) {
2738 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2743 * Set/get/unset an enforced vertex with geom object on face
2745 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2749 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2750 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2753 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2754 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2757 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2758 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
2759 // if (CORBA::is_nil(measureOp))
2762 // CORBA::Double x, y, z;
2764 // measureOp->PointCoordinates(theVertex, x, y, z);
2766 string theFaceEntry = theFace->GetStudyEntry();
2767 string theVertexEntry = theVertex->GetStudyEntry();
2769 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2772 if (theFaceEntry.empty()) {
2773 if (theFace->GetShapeType() == GEOM::FACE)
2775 if (theFace->GetShapeType() == GEOM::COMPOUND)
2776 aName = "Compound_";
2777 aName += theFace->GetEntry();
2778 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2779 if (!theSFace->_is_nil())
2780 theFaceEntry = theSFace->GetID();
2782 if (theFaceEntry.empty())
2783 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2785 if (theVertexEntry.empty()) {
2786 if (theVertex->GetShapeType() == GEOM::VERTEX)
2788 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2789 aName = "Compound_";
2790 aName += theVertex->GetEntry();
2791 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
2792 if (!theSVertex->_is_nil())
2793 theVertexEntry = theSVertex->GetID();
2795 if (theVertexEntry.empty())
2796 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2798 string theVertexName = theVertex->GetName();
2800 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
2801 } catch (SALOME_Exception& ex) {
2802 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2807 * Set an enforced vertex with group name on face
2809 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
2813 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2814 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2817 string theFaceEntry = theFace->GetStudyEntry();
2819 if (theFaceEntry.empty()) {
2820 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2822 if (theFace->GetShapeType() == GEOM::FACE)
2824 if (theFace->GetShapeType() == GEOM::COMPOUND)
2825 aName = "Compound_";
2826 aName += theFace->GetEntry();
2827 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2828 if (!theSFace->_is_nil())
2829 theFaceEntry = theSFace->GetID();
2831 if (theFaceEntry.empty())
2832 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2834 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
2835 } catch (SALOME_Exception& ex) {
2836 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2841 * Set an enforced vertex with name and group name on face
2843 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z,
2844 const char* theVertexName, const char* theGroupName)
2848 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2849 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2852 string theFaceEntry = theFace->GetStudyEntry();
2854 if (theFaceEntry.empty()) {
2855 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2857 if (theFace->GetShapeType() == GEOM::FACE)
2859 if (theFace->GetShapeType() == GEOM::COMPOUND)
2860 aName = "Compound_";
2861 aName += theFace->GetEntry();
2862 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2863 if (!theSFace->_is_nil())
2864 theFaceEntry = theSFace->GetID();
2866 if (theFaceEntry.empty())
2867 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2869 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
2870 } catch (SALOME_Exception& ex) {
2871 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2876 * Set an enforced vertex with geom entry and group name on face
2878 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
2882 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2883 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2886 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2887 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2890 string theFaceEntry = theFace->GetStudyEntry();
2891 string theVertexEntry = theVertex->GetStudyEntry();
2893 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2896 if (theFaceEntry.empty()) {
2897 if (theFace->GetShapeType() == GEOM::FACE)
2899 if (theFace->GetShapeType() == GEOM::COMPOUND)
2900 aName = "Compound_";
2901 aName += theFace->GetEntry();
2902 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2903 if (!theSFace->_is_nil())
2904 theFaceEntry = theSFace->GetID();
2906 if (theFaceEntry.empty())
2907 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2909 if (theVertexEntry.empty()) {
2910 if (theVertex->GetShapeType() == GEOM::VERTEX)
2912 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2913 aName = "Compound_";
2914 aName += theVertex->GetEntry();
2915 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
2916 if (!theSVertex->_is_nil())
2917 theVertexEntry = theSVertex->GetID();
2919 if (theVertexEntry.empty())
2920 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2922 string theVertexName = theVertex->GetName();
2924 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
2925 } catch (SALOME_Exception& ex) {
2926 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2930 //Enable internal enforced vertices on specific face if requested by user
2932 // * Are internal enforced vertices used for a face ?
2934 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
2936 // ASSERT(myBaseImpl);
2938 // if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2939 // THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2942 // string theFaceEntry = theFace->GetStudyEntry();
2944 // if (theFaceEntry.empty()) {
2945 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2947 // if (theFace->GetShapeType() == GEOM::FACE)
2949 // if (theFace->GetShapeType() == GEOM::COMPOUND)
2950 // aName = "Compound_";
2951 // aName += theFace->GetEntry();
2952 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2953 // if (!theSFace->_is_nil())
2954 // theFaceEntry = theSFace->GetID();
2956 // if (theFaceEntry.empty())
2957 // THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2960 // return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
2961 // } catch (SALOME_Exception& ex) {
2962 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2967 * Get the list of all enforced vertices
2969 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
2973 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2974 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2977 string theFaceEntry = theFace->GetStudyEntry();
2979 if (theFaceEntry.empty()) {
2980 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2982 if (theFace->GetShapeType() == GEOM::FACE)
2984 if (theFace->GetShapeType() == GEOM::COMPOUND)
2985 aName = "Compound_";
2986 aName += theFace->GetEntry();
2987 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2988 if (!theSFace->_is_nil())
2989 theFaceEntry = theSFace->GetID();
2991 if (theFaceEntry.empty())
2992 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2995 return GetEnforcedVerticesEntry(theFaceEntry.c_str());
2996 } catch (SALOME_Exception& ex) {
2997 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3001 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
3005 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
3006 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
3009 string theFaceEntry = theFace->GetStudyEntry();
3011 if (theFaceEntry.empty()) {
3012 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
3014 if (theFace->GetShapeType() == GEOM::FACE)
3016 if (theFace->GetShapeType() == GEOM::COMPOUND)
3017 aName = "Compound_";
3018 aName += theFace->GetEntry();
3019 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
3020 if (!theSFace->_is_nil())
3021 theFaceEntry = theSFace->GetID();
3023 if (theFaceEntry.empty())
3024 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3027 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
3028 } catch (SALOME_Exception& ex) {
3029 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3033 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
3037 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
3038 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
3040 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3041 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3044 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
3045 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
3046 // if (CORBA::is_nil(measureOp))
3049 // CORBA::Double x, y, z;
3051 // measureOp->PointCoordinates(theVertex, x, y, z);
3053 std::string theFaceEntry = theFace->GetStudyEntry();
3054 std::string theVertexEntry = theVertex->GetStudyEntry();
3056 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
3059 if (theFaceEntry.empty()) {
3060 if (theFace->GetShapeType() == GEOM::FACE)
3062 if (theFace->GetShapeType() == GEOM::COMPOUND)
3063 aName = "Compound_";
3064 aName += theFace->GetEntry();
3065 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
3066 if (!theSFace->_is_nil())
3067 theFaceEntry = theSFace->GetID();
3069 if (theFaceEntry.empty())
3070 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3072 if (theVertexEntry.empty()) {
3073 if (theVertex->GetShapeType() == GEOM::VERTEX)
3075 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3076 aName = "Compound_";
3077 aName += theVertex->GetEntry();
3078 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
3079 if (!theSVertex->_is_nil())
3080 theVertexEntry = theSVertex->GetID();
3082 if (theVertexEntry.empty())
3083 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3087 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
3088 } catch (SALOME_Exception& ex) {
3089 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3093 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) {
3096 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
3097 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
3100 string theFaceEntry = theFace->GetStudyEntry();
3102 if (theFaceEntry.empty()) {
3103 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
3105 if (theFace->GetShapeType() == GEOM::FACE)
3107 if (theFace->GetShapeType() == GEOM::COMPOUND)
3108 aName = "Compound_";
3109 aName += theFace->GetEntry();
3110 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
3111 if (!theSFace->_is_nil())
3112 theFaceEntry = theSFace->GetID();
3114 if (theFaceEntry.empty())
3115 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3119 return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
3120 } catch (SALOME_Exception& ex) {
3121 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3126 * Set/get/unset an enforced vertex on face - NEW (no face)
3128 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
3133 return SetEnforcedVertexEntry("", x, y, z);
3134 } catch (SALOME_Exception& ex) {
3135 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3140 * Set/get/unset an enforced vertex with name on face
3142 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName)
3145 return SetEnforcedVertexEntry("", x, y, z, theVertexName);
3146 } catch (SALOME_Exception& ex) {
3147 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3152 * Set/get/unset an enforced vertex with geom object on face
3154 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
3156 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3157 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3159 string theVertexEntry = theVertex->GetStudyEntry();
3161 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theVertex );
3164 if (theVertexEntry.empty()) {
3165 if (theVertex->GetShapeType() == GEOM::VERTEX)
3167 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3168 aName = "Compound_";
3169 aName += theVertex->GetEntry();
3170 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
3171 if (!theSVertex->_is_nil())
3172 theVertexEntry = theSVertex->GetID();
3174 if (theVertexEntry.empty())
3175 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3177 string theVertexName = theVertex->GetName();
3179 return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
3180 } catch (SALOME_Exception& ex) {
3181 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3186 * Set an enforced vertex with group name on face
3188 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
3193 return SetEnforcedVertexEntry("", x, y, z, "", "", theGroupName);
3194 } catch (SALOME_Exception& ex) {
3195 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3200 * Set an enforced vertex with name and group name on face
3202 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z,
3203 const char* theVertexName, const char* theGroupName)
3208 return SetEnforcedVertexEntry("", x, y, z, theVertexName, "", theGroupName);
3209 } catch (SALOME_Exception& ex) {
3210 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3215 * Set an enforced vertex with geom entry and group name on face
3217 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
3219 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3220 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3223 string theVertexEntry = theVertex->GetStudyEntry();
3225 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theVertex );
3228 if (theVertexEntry.empty()) {
3229 if (theVertex->GetShapeType() == GEOM::VERTEX)
3231 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3232 aName = "Compound_";
3233 aName += theVertex->GetEntry();
3234 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
3235 if (!theSVertex->_is_nil())
3236 theVertexEntry = theSVertex->GetID();
3238 if (theVertexEntry.empty())
3239 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3241 string theVertexName = theVertex->GetName();
3243 return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
3244 } catch (SALOME_Exception& ex) {
3245 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3249 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
3252 return UnsetEnforcedVertexEntry("", x, y, z);
3253 } catch (SALOME_Exception& ex) {
3254 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3258 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
3260 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3261 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3263 std::string theVertexEntry = theVertex->GetStudyEntry();
3265 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theVertex );
3268 if (theVertexEntry.empty()) {
3269 if (theVertex->GetShapeType() == GEOM::VERTEX)
3271 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3272 aName = "Compound_";
3273 aName += theVertex->GetEntry();
3274 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
3275 if (!theSVertex->_is_nil())
3276 theVertexEntry = theSVertex->GetID();
3278 if (theVertexEntry.empty())
3279 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3282 return UnsetEnforcedVertexEntry("", 0, 0, 0, theVertexEntry.c_str());
3283 } catch (SALOME_Exception& ex) {
3284 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3288 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertices()
3291 return UnsetEnforcedVerticesEntry("");
3292 } catch (SALOME_Exception& ex) {
3293 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3298 * Set/get/unset an enforced vertex on geom object given by entry
3300 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry,
3304 const char* theVertexName,
3305 const char* theVertexEntry,
3306 const char* theGroupName)
3308 bool newValue = false;
3309 if (string(theVertexEntry).empty()) {
3311 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
3312 this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
3313 ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
3314 coords.push_back(x);
3315 coords.push_back(y);
3316 coords.push_back(z);
3317 if (coordsList.find(coords) == coordsList.end()) {
3320 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
3321 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3325 } catch (const std::invalid_argument& ex) {
3326 // no enforced vertex for entry
3330 if (string(theVertexName).empty()) {
3331 if (string(theGroupName).empty())
3332 SMESH::TPythonDump() << _this() << ".AddEnforcedVertex(" << x << ", " << y << ", " << z << ")";
3334 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
3337 if (string(theGroupName).empty())
3338 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
3340 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", \""
3341 << theVertexName << "\", \"" << theGroupName << "\")";
3346 ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
3347 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
3348 if ( it == enfVertexEntryList.end()) {
3352 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
3353 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3357 } catch (const std::invalid_argument& ex) {
3358 // no enforced vertex for entry
3362 if (string(theGroupName).empty())
3363 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeom(" << theVertexEntry << ")";
3365 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeomWithGroup(" << theVertexEntry << ", \"" << theGroupName << "\")";
3370 this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
3375 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
3378 BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
3379 ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
3380 vertexList->length((CORBA::ULong) _vList.size());
3381 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
3382 for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
3383 ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
3385 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
3388 enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
3389 // Geom Vertex Entry
3390 enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
3392 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
3393 coords->length((CORBA::ULong) _enfVertex->coords.size());
3394 for ( CORBA::ULong ind = 0; ind < coords->length(); ind++ )
3395 coords[ind] = _enfVertex->coords[ind];
3396 enfVertex->coords = coords;
3398 enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
3400 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
3401 faceEntryList->length((CORBA::ULong) _enfVertex->faceEntries.size());
3402 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
3403 for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
3404 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
3405 enfVertex->faceEntries = faceEntryList;
3407 vertexList[i] = enfVertex;
3409 return vertexList._retn();
3410 } catch (const std::invalid_argument& ex) {
3411 SALOME::ExceptionStruct ExDescription;
3412 ExDescription.text = ex.what();
3413 ExDescription.type = SALOME::BAD_PARAM;
3414 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
3415 ExDescription.lineNumber = 1385;
3416 throw SALOME::SALOME_Exception(ExDescription);
3417 } catch (const std::exception& ex) {
3418 std::cout << "Exception: " << ex.what() << std::endl;
3419 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3423 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexEntry)
3429 res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
3431 if (string(theVertexEntry).empty())
3432 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertex(" << x << ", " << y << ", " << z
3435 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom(" << theVertexEntry << ")";
3437 } catch (const std::invalid_argument& ex) {
3439 } catch (const std::exception& ex) {
3440 std::cout << "Exception: " << ex.what() << std::endl;
3441 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3446 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry)
3451 this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
3452 SMESH::TPythonDump() << _this() << ".RemoveEnforcedVertices()";
3453 } catch (const std::invalid_argument& ex) {
3455 } catch (const std::exception& ex) {
3456 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3462 //=============================================================================
3464 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
3468 //=============================================================================
3469 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue)
3472 this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
3473 std::string theValueStr = theValue ? "True" : "False";
3474 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
3477 //=============================================================================
3479 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
3483 //=============================================================================
3484 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces()
3487 return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
3490 //=============================================================================
3492 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
3496 //=============================================================================
3497 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName)
3500 this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
3501 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
3504 //=============================================================================
3506 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
3510 //=============================================================================
3511 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup()
3514 return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
3518 * Enable internal enforced vertices on specific face if requested by user
3520 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
3523 SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
3524 } catch (SALOME_Exception& ex) {
3525 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3529 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3531 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
3532 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
3535 string theFaceEntry = theFace->GetStudyEntry();
3537 if (theFaceEntry.empty()) {
3538 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
3539 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3541 if (theFace->GetShapeType() == GEOM::FACE)
3543 if (theFace->GetShapeType() == GEOM::COMPOUND)
3544 aName = "Compound_";
3545 aName += theFace->GetEntry();
3546 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
3547 if (!theSFace->_is_nil())
3548 theFaceEntry = theSFace->GetID();
3550 if (theFaceEntry.empty())
3551 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3554 SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
3555 } catch (SALOME_Exception& ex) {
3556 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3560 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3564 this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
3565 std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
3566 if (string(theGroupName).empty())
3567 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
3569 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
3570 } catch (const std::exception& ex) {
3571 std::cout << "Exception: " << ex.what() << std::endl;
3572 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3579 char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
3584 return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
3586 catch (const std::invalid_argument& ex) {
3587 SALOME::ExceptionStruct ExDescription;
3588 ExDescription.text = ex.what();
3589 ExDescription.type = SALOME::BAD_PARAM;
3590 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
3591 ExDescription.lineNumber = 1146;
3592 throw SALOME::SALOME_Exception(ExDescription);
3594 catch (SALOME_Exception& ex) {
3595 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3601 void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
3605 this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
3607 catch (const std::invalid_argument& ex) {
3608 SALOME::ExceptionStruct ExDescription;
3609 ExDescription.text = ex.what();
3610 ExDescription.type = SALOME::BAD_PARAM;
3611 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
3612 ExDescription.lineNumber = 1170;
3613 throw SALOME::SALOME_Exception(ExDescription);
3615 catch (SALOME_Exception& ex) {
3616 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3619 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
3620 << x << ", " << y << ", " << z << ", '" << groupName << "' )";
3624 ///////////////////////
3626 ///////////////////////
3628 ///////////////////////
3631 std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
3633 std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
3634 MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
3635 MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
3636 MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID");
3637 MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL");
3638 MapShapeTypeToString[GEOM::FACE] = std::string("FACE");
3639 MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE");
3640 MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE");
3641 MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX");
3642 MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE");
3643 std::string txtShapeType = MapShapeTypeToString[theShapeType];
3644 return txtShapeType;
3647 void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes)
3649 // Check shape types
3651 std::stringstream typesTxt;
3652 for (std::size_t i=0; i<theShapeTypes.size(); i++)
3654 GEOM::shape_type theShapeType = theShapeTypes[i];
3655 if (shape->GetShapeType() == theShapeType)
3657 typesTxt << ShapeTypeToString(theShapeType);
3658 if (i < theShapeTypes.size()-1 )
3663 std::stringstream msg;
3664 msg << "shape type is not in" << typesTxt.str();
3665 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3669 void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType)
3672 if (shape->GetShapeType() != theShapeType) {
3673 std::stringstream msg;
3674 msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
3675 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3679 std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix)
3681 // Check shape is published in the object browser
3682 string shapeEntry = shape->GetStudyEntry();
3684 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( shape );
3687 // Publish shape if needed
3688 if (shapeEntry.empty()) {
3689 if (shape->GetShapeType() == theShapeType)
3691 aName += shape->GetEntry();
3692 SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(NULL, shape, aName.c_str());
3693 if (!theSFace1->_is_nil())
3694 shapeEntry = theSFace1->GetID();
3696 if (shapeEntry.empty())
3697 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3701 // Format the output of two vectors to use it in MESSAGE and PythonDump
3702 std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
3704 std::stringstream listEntriesTxt;
3706 if (!theSourceVerticesEntries.empty())
3708 listEntriesTxt << ", [" ;
3710 for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
3713 listEntriesTxt << ", ";
3714 listEntriesTxt << *it;
3717 listEntriesTxt << "], [" ;
3719 for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
3722 listEntriesTxt << ", ";
3723 listEntriesTxt << *it;
3725 listEntriesTxt << "]" ;
3727 return listEntriesTxt.str();
3731 * Erase all PreCad periodicity associations
3733 void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
3735 this->GetImpl()->ClearPreCadPeriodicityVectors();
3736 SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
3739 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
3741 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3742 this->GetImpl()->_GetPreCadFacesPeriodicityVector();
3744 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3746 return periodicityList._retn();
3749 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
3751 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3752 this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
3754 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3756 return periodicityList._retn();
3759 // convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
3760 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
3762 BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
3764 periodicityList->length((CORBA::ULong) preCadPeriodicityVector.size());
3766 for ( CORBA::ULong i = 0; i<preCadPeriodicityVector.size(); i++)
3768 ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
3770 BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
3771 myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
3772 myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
3774 BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
3775 if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
3777 sourceVertices->length((CORBA::ULong) preCadPeriodicityVector_i.theSourceVerticesEntries.size());
3778 for (CORBA::ULong j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
3779 sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
3782 myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
3784 BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
3785 if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
3787 targetVertices->length((CORBA::ULong) preCadPeriodicityVector_i.theTargetVerticesEntries.size());
3788 for (CORBA::ULong j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
3789 targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
3792 myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
3794 periodicityList[i] = myPreCadPeriodicity;
3798 return periodicityList._retn();
3802 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
3805 const GEOM::ListOfGO theSourceVertices;
3806 const GEOM::ListOfGO theTargetVertices;
3807 AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices);
3811 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
3812 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3816 size_t theLength = theSourceVertices.length();
3817 if (theLength != theTargetVertices.length())
3818 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3820 std::vector<GEOM::shape_type> allowedShapeTypes;
3821 allowedShapeTypes.push_back(GEOM::FACE);
3822 allowedShapeTypes.push_back(GEOM::COMPOUND);
3824 string prefix1 = "Source_face_";
3825 CheckShapeTypes(theFace1, allowedShapeTypes);
3826 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
3828 string prefix2 = "Target_face_";
3829 CheckShapeTypes(theFace2, allowedShapeTypes);
3830 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
3832 string prefix3 = "Source_vertex_";
3833 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3834 theSourceVerticesEntries->length((CORBA::ULong) theLength);
3835 GEOM::GEOM_Object_ptr theVtx_i;
3837 for (CORBA::ULong ind = 0; ind < theLength; ind++) {
3838 theVtx_i = theSourceVertices[ind];
3839 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3840 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3843 string prefix4 = "Target_vertex_";
3844 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3845 theTargetVerticesEntries->length((CORBA::ULong) theLength);
3846 for ( CORBA::ULong ind = 0; ind < theLength; ind++) {
3847 theVtx_i = theTargetVertices[ind];
3848 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3849 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3852 string theFace2Name = theFace2->GetName();
3854 AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
3855 theSourceVerticesEntries, theTargetVerticesEntries);
3856 } catch (SALOME_Exception& ex) {
3857 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3862 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
3863 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3867 // Convert BLSURFPlugin::TEntryList to vector<string>
3868 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3869 for ( CORBA::ULong ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3870 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3871 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3874 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3877 this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
3878 theSourceVerticesEntries, theTargetVerticesEntries);
3880 SMESH::TPythonDump pd;
3881 if (!theSourceVerticesEntries.empty())
3883 pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
3884 pd << listEntriesTxt.c_str();
3888 pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
3891 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
3894 const GEOM::ListOfGO theSourceVertices;
3895 const GEOM::ListOfGO theTargetVertices;
3896 AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices);
3899 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
3900 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3904 size_t theLength = theSourceVertices.length();
3905 if (theLength != theTargetVertices.length())
3906 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3908 std::vector<GEOM::shape_type> allowedShapeTypes;
3909 allowedShapeTypes.push_back(GEOM::EDGE);
3910 allowedShapeTypes.push_back(GEOM::COMPOUND);
3912 string prefix1 = "Source_edge_";
3913 CheckShapeTypes(theEdge1, allowedShapeTypes);
3914 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1);
3916 string prefix2 = "Target_edge_";
3917 CheckShapeTypes(theEdge2, allowedShapeTypes);
3918 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
3920 string prefix3 = "Source_vertex_";
3921 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3922 theSourceVerticesEntries->length((CORBA::ULong) theLength);
3923 GEOM::GEOM_Object_ptr theVtx_i;
3925 for (CORBA::ULong ind = 0; ind < theLength; ind++) {
3926 theVtx_i = theSourceVertices[ind];
3927 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3928 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3931 string prefix4 = "Target_vertex_";
3932 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3933 theTargetVerticesEntries->length((CORBA::ULong) theLength);
3934 for (CORBA::ULong ind = 0; ind < theLength; ind++) {
3935 theVtx_i = theTargetVertices[ind];
3936 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3937 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3940 string theEdge2Name = theEdge2->GetName();
3942 AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
3943 theSourceVerticesEntries, theTargetVerticesEntries);
3944 } catch (SALOME_Exception& ex) {
3945 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3950 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
3951 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3956 // Convert BLSURFPlugin::TEntryList to vector<string>
3957 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3958 for (CORBA::ULong ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3959 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3960 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3963 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3965 this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
3966 theSourceVerticesEntries, theTargetVerticesEntries);
3968 SMESH::TPythonDump pd;
3969 if (!theSourceVerticesEntries.empty())
3971 pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
3972 pd << listEntriesTxt.c_str();
3976 pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
3981 //================================================================================
3983 * \brief Sets the file for export resulting mesh in GMF format
3984 * \param theFileName - full name of the file (.mesh, .meshb)
3986 * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
3988 //================================================================================
3989 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
3990 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
3992 bool valueChanged/*, modeChanged*/ = false;
3994 valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
3995 // modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
3996 if (valueChanged)// or (!valueChanged && modeChanged))
3997 this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
3998 } catch (const std::exception& ex) {
3999 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
4001 if (valueChanged)// or (!valueChanged && modeChanged))
4002 SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
4005 //================================================================================
4007 * \brief Gets the file name for export resulting mesh in GMF format
4008 * \retval char* - The file name
4010 * Returns the GMF file name
4012 //================================================================================
4013 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
4015 return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
4018 // //================================================================================
4020 // * \brief Gets the file mode for export resulting mesh in GMF format
4021 // * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
4023 // * Returns the GMF file mode
4025 // //================================================================================
4026 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
4027 // ASSERT(myBaseImpl);
4028 // return this->GetImpl()->GetGMFFileMode();
4031 //=============================================================================
4033 * BLSURFPlugin_Hypothesis_i::GetImpl
4035 * Get implementation
4037 //=============================================================================
4038 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
4039 return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
4042 //================================================================================
4044 * \brief Verify whether hypothesis supports given entity type
4045 * \param type - dimension (see SMESH::Dimension enumeration)
4046 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
4048 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
4050 //================================================================================
4051 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
4052 return type == SMESH::DIM_2D;
4056 //================================================================================
4058 * \brief Return geometry this hypothesis depends on. Return false if there is no geometry parameter
4060 //================================================================================
4063 BLSURFPlugin_Hypothesis_i::getObjectsDependOn( std::vector< std::string > & entryArray,
4064 std::vector< int > & subIDArray ) const
4066 typedef ::BLSURFPlugin_Hypothesis BH;
4067 const BH* impl = static_cast<const BH*>( myBaseImpl );
4070 const BH::TSizeMap& sizeMap = impl->_GetSizeMapEntries();
4071 BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
4072 for ( ; entry2size != sizeMap.cend(); ++entry2size )
4073 entryArray.push_back( entry2size->first );
4076 const BH::TSizeMap& sizeMap = impl->_GetAttractorEntries();
4077 BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
4078 for ( ; entry2size != sizeMap.cend(); ++entry2size )
4079 entryArray.push_back( entry2size->first );
4082 const BH::TAttractorMap& classAttractors = impl-> _GetClassAttractorEntries();
4083 BH::TAttractorMap::const_iterator entry2size = classAttractors.cbegin();
4084 for ( ; entry2size != classAttractors.cend(); ++entry2size )
4085 entryArray.push_back( entry2size->first );
4088 const BH::TFaceEntryEnfVertexListMap& faceEntryEnfVertexListMap = impl->_GetAllEnforcedVerticesByFace();
4089 BH::TFaceEntryEnfVertexListMap::const_iterator entry2evList = faceEntryEnfVertexListMap.cbegin();
4090 for ( ; entry2evList != faceEntryEnfVertexListMap.cend(); ++entry2evList )
4092 entryArray.push_back( entry2evList->first );
4094 const BH::TEnfVertexList& evList = entry2evList->second;
4095 BH::TEnfVertexList::const_iterator evIt = evList.cbegin();
4096 for ( ; evIt != evList.cend(); ++evIt )
4098 const BH::TEnfVertex* ev = *evIt;
4099 entryArray.push_back( ev->geomEntry );
4100 entryArray.insert( entryArray.end(), ev->faceEntries.cbegin(), ev->faceEntries.cend() );
4104 // { // duplicated data of faceEntryEnfVertexListMap
4105 // const BH::TEnfVertexList& enfVertexList = impl->_GetAllEnforcedVertices();
4106 // const BH::TFaceEntryCoordsListMap& faceEntryCoordsListMap = impl->_GetAllCoordsByFace();
4107 // const BH::TFaceEntryEnfVertexEntryListMap& faceEntryEnfVertexEntryListMap = impl->_GetAllEnfV // const BH::TEnfVertexEntryEnfVertexMap& enfVertexEntryEnfVertexMap = impl->_GetAllEnforcedVert // }
4109 const BH::TPreCadPeriodicityVector& preCadFacesPeriodicityVector = impl->_GetPreCadFacesPeriodicityVector();
4110 BH::TPreCadPeriodicityVector::const_iterator pcp = preCadFacesPeriodicityVector.cbegin();
4111 for ( ; pcp != preCadFacesPeriodicityVector.cend(); ++pcp )
4113 entryArray.push_back( pcp->shape1Entry );
4114 entryArray.push_back( pcp->shape2Entry );
4115 entryArray.insert( entryArray.end(),
4116 pcp->theSourceVerticesEntries.cbegin(),
4117 pcp->theSourceVerticesEntries.cend() );
4118 entryArray.insert( entryArray.end(),
4119 pcp->theTargetVerticesEntries.cbegin(),
4120 pcp->theTargetVerticesEntries.cend() );
4124 const BH::TPreCadPeriodicityVector& preCadEdgesPeriodicityVector = impl->_GetPreCadEdgesPeriodicityVector();
4125 BH::TPreCadPeriodicityVector::const_iterator pcp = preCadEdgesPeriodicityVector.cbegin();
4126 for ( ; pcp != preCadEdgesPeriodicityVector.cend(); ++pcp )
4128 entryArray.push_back( pcp->shape1Entry );
4129 entryArray.push_back( pcp->shape2Entry );
4130 entryArray.insert( entryArray.end(),
4131 pcp->theSourceVerticesEntries.cbegin(),
4132 pcp->theSourceVerticesEntries.cend() );
4133 entryArray.insert( entryArray.end(),
4134 pcp->theTargetVerticesEntries.cbegin(),
4135 pcp->theTargetVerticesEntries.cend() );
4139 const BH::THyperPatchList& hyperPatchList = impl->GetHyperPatches();
4140 BH::THyperPatchList::const_iterator idSet = hyperPatchList.cbegin();
4141 for ( ; idSet != hyperPatchList.cend(); ++idSet )
4143 subIDArray.insert( subIDArray.end(), idSet->cbegin(), idSet->cend() );
4149 //================================================================================
4151 * \brief Set new geometry instead of that returned by getObjectsDependOn()
4153 //================================================================================
4156 BLSURFPlugin_Hypothesis_i::setObjectsDependOn( std::vector< std::string > & entryArray,
4157 std::vector< int > & subIDArray )
4159 typedef ::BLSURFPlugin_Hypothesis BH;
4160 BH* impl = static_cast<BH*>( myBaseImpl );
4164 BH::TSizeMap& sizeMapNew = const_cast< BH::TSizeMap& >( impl->_GetSizeMapEntries() );
4165 BH::TSizeMap sizeMap;
4166 sizeMap.swap( sizeMapNew );
4167 BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
4168 for ( ; entry2size != sizeMap.cend(); ++entry2size, ++iEnt )
4169 if ( entryArray[ iEnt ].empty() == entry2size->first.empty() )
4170 sizeMapNew[ entryArray[ iEnt ]] = entry2size->second;
4173 BH::TSizeMap& sizeMapNew = const_cast< BH::TSizeMap& >( impl->_GetAttractorEntries() );
4174 BH::TSizeMap sizeMap;
4175 sizeMap.swap( sizeMapNew );
4176 BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
4177 for ( ; entry2size != sizeMap.cend(); ++entry2size, ++iEnt )
4178 if ( entryArray[ iEnt ].empty() == entry2size->first.empty() )
4179 sizeMapNew[ entryArray[ iEnt ]] = entry2size->second;
4182 BH::TAttractorMap& attrMapNew =
4183 const_cast< BH::TAttractorMap& > ( impl->_GetClassAttractorEntries() );
4184 BH::TAttractorMap attrMap;
4185 attrMap.swap( attrMapNew );
4186 BH::TAttractorMap::const_iterator entry2size = attrMap.cbegin();
4187 for ( ; entry2size != attrMap.cend(); ++entry2size, ++iEnt )
4188 if ( entryArray[ iEnt ].empty() == entry2size->first.empty() )
4189 attrMapNew.insert( std::make_pair( entryArray[ iEnt ], entry2size->second ));
4191 delete entry2size->second;
4194 BH::TFaceEntryEnfVertexListMap& faceEntryEnfVertexListMapNew =
4195 const_cast< BH::TFaceEntryEnfVertexListMap& >( impl->_GetAllEnforcedVerticesByFace() );
4196 BH::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap;
4197 faceEntryEnfVertexListMap.swap( faceEntryEnfVertexListMapNew );
4199 BH::TEnfVertexList& enfVertexList =
4200 const_cast< BH::TEnfVertexList& > ( impl->_GetAllEnforcedVertices() );
4201 enfVertexList.clear(); // avoid removal
4203 impl->ClearAllEnforcedVertices();
4205 BH::TFaceEntryEnfVertexListMap::iterator entry2evList = faceEntryEnfVertexListMap.begin();
4206 for ( ; entry2evList != faceEntryEnfVertexListMap.end(); ++entry2evList )
4208 const BH::TEntry& entry = entryArray[ iEnt++ ];
4209 bool faceOk = ( entry.empty() == entry2evList->first.empty() );
4211 BH::TEnfVertexList& evList = entry2evList->second;
4212 BH::TEnfVertexList::iterator evIt = evList.begin();
4213 for ( ; evIt != evList.end(); ++evIt )
4215 BH::TEnfVertex* ev = *evIt;
4216 bool ok = faceOk && ( ev->geomEntry.empty() != entryArray[ iEnt ].empty() );
4217 ev->geomEntry = entryArray[ iEnt++ ];
4218 BH::TEntryList faceEntriesNew;
4219 BH::TEntryList::iterator fEnt = ev->faceEntries.begin();
4220 for ( ; fEnt != ev->faceEntries.end(); ++fEnt, ++iEnt )
4222 if ( !entryArray[ iEnt ].empty() )
4223 faceEntriesNew.insert( entryArray[ iEnt ]);
4227 ev->faceEntries.swap( faceEntriesNew );
4228 impl->AddEnforcedVertex( entry, ev );
4238 BH::TPreCadPeriodicityVector& preCadPeriodicityVector =
4239 const_cast< BH::TPreCadPeriodicityVector&> ( impl->_GetPreCadFacesPeriodicityVector() );
4240 BH::TPreCadPeriodicityVector::iterator pcp = preCadPeriodicityVector.begin();
4241 for ( ; pcp != preCadPeriodicityVector.end(); ++pcp )
4243 pcp->shape1Entry = entryArray[ iEnt++ ];
4244 pcp->shape2Entry = entryArray[ iEnt++ ];
4245 for ( size_t i = 0; i < pcp->theSourceVerticesEntries.size(); ++i, iEnt++ )
4246 pcp->theSourceVerticesEntries[i] = entryArray[ iEnt ];
4248 for ( size_t i = 0; i < pcp->theTargetVerticesEntries.size(); ++i, iEnt++ )
4249 pcp->theTargetVerticesEntries[i] = entryArray[ iEnt ];
4253 BH::TPreCadPeriodicityVector& preCadPeriodicityVector =
4254 const_cast< BH::TPreCadPeriodicityVector&> ( impl->_GetPreCadEdgesPeriodicityVector() );
4255 BH::TPreCadPeriodicityVector::iterator pcp = preCadPeriodicityVector.begin();
4256 for ( ; pcp != preCadPeriodicityVector.end(); ++pcp )
4258 pcp->shape1Entry = entryArray[ iEnt++ ];
4259 pcp->shape2Entry = entryArray[ iEnt++ ];
4260 for ( size_t i = 0; i < pcp->theSourceVerticesEntries.size(); ++i, iEnt++ )
4261 pcp->theSourceVerticesEntries[i] = entryArray[ iEnt ];
4263 for ( size_t i = 0; i < pcp->theTargetVerticesEntries.size(); ++i, iEnt++ )
4264 pcp->theTargetVerticesEntries[i] = entryArray[ iEnt ];
4270 BH::THyperPatchList& hyperPatchListNew =
4271 const_cast< BH::THyperPatchList& >( impl->GetHyperPatches() );
4272 BH::THyperPatchList hyperPatchList;
4273 hyperPatchList.swap( hyperPatchListNew );
4274 BH::THyperPatchList::iterator idSet = hyperPatchList.begin();
4275 for ( ; idSet != hyperPatchList.end(); ++idSet )
4277 BH::THyperPatchTags& ids = *idSet;
4278 BH::THyperPatchTags idsNew;
4279 BH::THyperPatchTags::iterator i = ids.begin();
4280 for ( ; i != ids.end(); ++i, ++iID )
4281 if ( subIDArray[ iID ] > 0 )
4282 idsNew.insert( subIDArray[ iID ]);
4283 if ( !idsNew.empty() )
4284 hyperPatchListNew.push_back( idsNew );
4288 return ( iEnt == entryArray.size() && iID == subIDArray.size() );