1 // Copyright (C) 2007-2019 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 // File : BLSURFPlugin_Hypothesis.cxx
22 // Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA)
23 // Size maps developement: Nicolas GEIMER (OCC) & Gilles DAVID (EURIWARE)
26 #include "BLSURFPlugin_Hypothesis_i.hxx"
28 #include <SMESH_Gen.hxx>
29 #include <SMESH_Gen_i.hxx>
30 #include <SMESH_PythonDump.hxx>
32 #include <SALOMEDS_wrap.hxx>
33 #include <Utils_CorbaException.hxx>
34 #include <utilities.h>
38 #include <boost/regex.hpp>
42 //=============================================================================
44 * BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i
48 //=============================================================================
49 BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA,
50 ::SMESH_Gen* theGenImpl,
52 SALOME::GenericObj_i(thePOA), SMESH_Hypothesis_i(thePOA)
54 myBaseImpl = new ::BLSURFPlugin_Hypothesis(theGenImpl->GetANewId(),
60 //=============================================================================
62 * BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i
66 //=============================================================================
67 BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i()
71 //=============================================================================
73 //=============================================================================
75 * BLSURFPlugin_Hypothesis_i::SetPhysicalMesh
80 //=============================================================================
81 void BLSURFPlugin_Hypothesis_i::SetPhysicalMesh(CORBA::Long theValue)
84 this->GetImpl()->SetPhysicalMesh((::BLSURFPlugin_Hypothesis::PhysicalMesh) theValue);
85 SMESH::TPythonDump() << _this() << ".SetPhysicalMesh( " << theValue << " )";
88 //=============================================================================
90 * BLSURFPlugin_Hypothesis_i::GetPhysicalMesh
94 //=============================================================================
95 CORBA::Long BLSURFPlugin_Hypothesis_i::GetPhysicalMesh()
98 return this->GetImpl()->GetPhysicalMesh();
101 //=============================================================================
103 * BLSURFPlugin_Hypothesis_i::SetGeometricMesh
108 //=============================================================================
109 void BLSURFPlugin_Hypothesis_i::SetGeometricMesh(CORBA::Long theValue)
112 this->GetImpl()->SetGeometricMesh((::BLSURFPlugin_Hypothesis::GeometricMesh) theValue);
113 SMESH::TPythonDump() << _this() << ".SetGeometricMesh( " << theValue << " )";
116 //=============================================================================
118 * BLSURFPlugin_Hypothesis_i::GetGeometricMesh
122 //=============================================================================
123 CORBA::Long BLSURFPlugin_Hypothesis_i::GetGeometricMesh()
126 return this->GetImpl()->GetGeometricMesh();
129 //=============================================================================
131 * BLSURFPlugin_Hypothesis_i::SetPhySize
135 //=============================================================================
136 void BLSURFPlugin_Hypothesis_i::SetPhySize(CORBA::Double theValue)
139 this->GetImpl()->SetPhySize(theValue, false);
140 SMESH::TPythonDump() << _this() << ".SetPhySize( " << theValue << " )";
143 //=============================================================================
145 * BLSURFPlugin_Hypothesis_i::SetPhySizeRel
147 * Set Relative PhySize
149 //=============================================================================
150 void BLSURFPlugin_Hypothesis_i::SetPhySizeRel(CORBA::Double theValue)
153 this->GetImpl()->SetPhySize(theValue, true);
154 SMESH::TPythonDump() << _this() << ".SetPhySizeRel( " << theValue << " )";
157 //=============================================================================
159 * BLSURFPlugin_Hypothesis_i::GetPhySize
163 //=============================================================================
164 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhySize()
167 return this->GetImpl()->GetPhySize();
170 //=============================================================================
172 * BLSURFPlugin_Hypothesis_i::IsPhySizeRel
174 * Returns True if PhySize is relative
176 //=============================================================================
177 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsPhySizeRel()
180 return this->GetImpl()->IsPhySizeRel();
183 //=============================================================================
184 void BLSURFPlugin_Hypothesis_i::SetMinSize(CORBA::Double theMinSize)
186 if (IsMinSizeRel() || GetMinSize() != theMinSize ) {
187 this->GetImpl()->SetMinSize(theMinSize, false);
188 SMESH::TPythonDump() << _this() << ".SetMinSize( " << theMinSize << " )";
192 //=============================================================================
193 void BLSURFPlugin_Hypothesis_i::SetMinSizeRel(CORBA::Double theMinSize)
195 if ( !IsMinSizeRel() || (GetMinSize() != theMinSize) ) {
196 this->GetImpl()->SetMinSize(theMinSize, true);
197 SMESH::TPythonDump() << _this() << ".SetMinSizeRel( " << theMinSize << " )";
201 //=============================================================================
202 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMinSize()
204 return this->GetImpl()->GetMinSize();
207 //=============================================================================
208 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMinSizeRel()
210 return this->GetImpl()->IsMinSizeRel();
213 //=============================================================================
214 void BLSURFPlugin_Hypothesis_i::SetMaxSize(CORBA::Double theMaxSize)
216 if (IsMaxSizeRel() || GetMaxSize() != theMaxSize) {
217 this->GetImpl()->SetMaxSize(theMaxSize, false);
218 SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theMaxSize << " )";
222 //=============================================================================
223 void BLSURFPlugin_Hypothesis_i::SetMaxSizeRel(CORBA::Double theMaxSize)
225 if ( !IsMaxSizeRel() || (GetMaxSize() != theMaxSize) ) {
226 this->GetImpl()->SetMaxSize(theMaxSize, true);
227 SMESH::TPythonDump() << _this() << ".SetMaxSizeRel( " << theMaxSize << " )";
231 //=============================================================================
232 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMaxSize()
234 return this->GetImpl()->GetMaxSize();
237 //=============================================================================
238 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMaxSizeRel()
240 return this->GetImpl()->IsMaxSizeRel();
244 //=============================================================================
246 * BLSURFPlugin_Hypothesis_i::SetUseGradation
250 //=============================================================================
251 void BLSURFPlugin_Hypothesis_i::SetUseGradation(CORBA::Boolean theValue)
253 if ( GetImpl()->GetUseGradation() != bool( theValue ))
255 this->GetImpl()->SetUseGradation(theValue);
256 std::string theValueStr = theValue ? "True" : "False";
257 SMESH::TPythonDump() << _this() << ".SetUseGradation( " << theValueStr.c_str() << " )";
261 //=============================================================================
263 * BLSURFPlugin_Hypothesis_i::GetUseGradation
267 //=============================================================================
268 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseGradation()
270 return this->GetImpl()->GetUseGradation();
273 //=============================================================================
275 * BLSURFPlugin_Hypothesis_i::SetGradation
279 //=============================================================================
280 void BLSURFPlugin_Hypothesis_i::SetGradation(CORBA::Double theValue)
282 this->GetImpl()->SetGradation(theValue);
285 SetUseGradation( false );
287 SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )";
290 //=============================================================================
292 * BLSURFPlugin_Hypothesis_i::GetGradation
296 //=============================================================================
297 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation()
299 return this->GetImpl()->GetGradation();
302 //=============================================================================
304 * BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation
308 //=============================================================================
309 void BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation(CORBA::Boolean theValue)
311 if ( GetImpl()->GetUseVolumeGradation() != bool( theValue ))
313 this->GetImpl()->SetUseVolumeGradation(theValue);
314 std::string theValueStr = theValue ? "True" : "False";
315 SMESH::TPythonDump() << _this() << ".SetUseVolumeGradation( " << theValueStr.c_str() << " )";
319 //=============================================================================
321 * BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation
325 //=============================================================================
326 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation()
328 return this->GetImpl()->GetUseVolumeGradation();
331 //=============================================================================
333 * BLSURFPlugin_Hypothesis_i::SetVolumeGradation
335 * Set VolumeGradation
337 //=============================================================================
338 void BLSURFPlugin_Hypothesis_i::SetVolumeGradation(CORBA::Double theValue)
340 this->GetImpl()->SetVolumeGradation(theValue);
342 SetUseVolumeGradation( false );
344 SMESH::TPythonDump() << _this() << ".SetVolumeGradation( " << theValue << " )";
347 //=============================================================================
349 * BLSURFPlugin_Hypothesis_i::GetVolumeGradation
351 * Get VolumeGradation
353 //=============================================================================
354 CORBA::Double BLSURFPlugin_Hypothesis_i::GetVolumeGradation()
356 return this->GetImpl()->GetVolumeGradation();
359 //=============================================================================
361 * BLSURFPlugin_Hypothesis_i::SetQuadAllowed
365 * DEPRACATED, kept for python script compatibility
367 * TO be removed in Salome 9
369 //=============================================================================
370 void BLSURFPlugin_Hypothesis_i::SetQuadAllowed(CORBA::Boolean theValue)
372 ::BLSURFPlugin_Hypothesis::ElementType theElementType = theValue ?
373 ::BLSURFPlugin_Hypothesis::QuadrangleDominant : ::BLSURFPlugin_Hypothesis::Triangles;
374 this->GetImpl()->SetElementType(theElementType);
375 SMESH::TPythonDump() << _this() << ".SetElementType( " << theElementType << " )";
378 //=============================================================================
380 * BLSURFPlugin_Hypothesis_i::SetElementType
384 //=============================================================================
385 void BLSURFPlugin_Hypothesis_i::SetElementType(CORBA::Long theValue)
387 this->GetImpl()->SetElementType((::BLSURFPlugin_Hypothesis::ElementType) theValue);
388 SMESH::TPythonDump() << _this() << ".SetElementType( " << theValue << " )";
390 //=============================================================================
392 * BLSURFPlugin_Hypothesis_i::GetElementType
396 //=============================================================================
397 CORBA::Long BLSURFPlugin_Hypothesis_i::GetElementType()
399 return this->GetImpl()->GetElementType();
402 //=============================================================================
404 * BLSURFPlugin_Hypothesis_i::SetAngleMesh
408 //=============================================================================
409 void BLSURFPlugin_Hypothesis_i::SetAngleMesh(CORBA::Double theValue)
411 this->GetImpl()->SetAngleMesh(theValue);
412 SMESH::TPythonDump() << _this() << ".SetAngleMesh( " << theValue << " )";
415 //=============================================================================
417 * BLSURFPlugin_Hypothesis_i::GetAngleMesh
421 //=============================================================================
422 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMesh()
424 return this->GetImpl()->GetAngleMesh();
427 //=============================================================================
429 * BLSURFPlugin_Hypothesis_i::SetChordalError
433 //=============================================================================
434 void BLSURFPlugin_Hypothesis_i::SetChordalError(CORBA::Double theValue)
436 this->GetImpl()->SetChordalError(theValue);
437 SMESH::TPythonDump() << _this() << ".SetChordalError( " << theValue << " )";
440 //=============================================================================
442 * BLSURFPlugin_Hypothesis_i::GetChordalError
446 //=============================================================================
447 CORBA::Double BLSURFPlugin_Hypothesis_i::GetChordalError()
449 return this->GetImpl()->GetChordalError();
452 //=============================================================================
454 * BLSURFPlugin_Hypothesis_i::SetAnisotropic
458 //=============================================================================
459 void BLSURFPlugin_Hypothesis_i::SetAnisotropic(CORBA::Boolean theValue)
461 this->GetImpl()->SetAnisotropic(theValue);
462 std::string theValueStr = theValue ? "True" : "False";
463 SMESH::TPythonDump() << _this() << ".SetAnisotropic( " << theValueStr.c_str() << " )";
466 //=============================================================================
468 * BLSURFPlugin_Hypothesis_i::GetAnisotropic
472 //=============================================================================
473 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetAnisotropic()
475 return this->GetImpl()->GetAnisotropic();
478 //=============================================================================
480 * BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio
482 * Set Anisotropic Ratio
484 //=============================================================================
485 void BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio(CORBA::Double theValue)
487 this->GetImpl()->SetAnisotropicRatio(theValue);
488 SMESH::TPythonDump() << _this() << ".SetAnisotropicRatio( " << theValue << " )";
491 //=============================================================================
493 * BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio
495 * Get Anisotropic Ratio
497 //=============================================================================
498 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio()
500 return this->GetImpl()->GetAnisotropicRatio();
504 //=============================================================================
506 * BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges
510 //=============================================================================
511 void BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges(CORBA::Boolean theValue) {
513 this->GetImpl()->SetRemoveTinyEdges(theValue);
514 std::string theValueStr = theValue ? "True" : "False";
515 SMESH::TPythonDump() << _this() << ".SetRemoveTinyEdges( " << theValueStr.c_str() << " )";
518 //=============================================================================
520 * BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges
524 //=============================================================================
525 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges() {
527 return this->GetImpl()->GetRemoveTinyEdges();
530 //=============================================================================
532 * BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength
534 * Set Tiny Edge Length
536 //=============================================================================
537 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength(CORBA::Double theValue) {
539 this->GetImpl()->SetTinyEdgeLength(theValue);
540 SMESH::TPythonDump() << _this() << ".SetTinyEdgeLength( " << theValue << " )";
543 //=============================================================================
545 * BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength
547 * Get Tiny Edge Length
549 //=============================================================================
550 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength() {
552 return this->GetImpl()->GetTinyEdgeLength();
555 //=============================================================================
557 * BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges
561 //=============================================================================
562 void BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges(CORBA::Boolean theValue) {
564 this->GetImpl()->SetOptimiseTinyEdges(theValue);
565 std::string theValueStr = theValue ? "True" : "False";
566 SMESH::TPythonDump() << _this() << ".SetOptimiseTinyEdges( " << theValueStr.c_str() << " )";
569 //=============================================================================
571 * BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges
575 //=============================================================================
576 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges() {
578 return this->GetImpl()->GetOptimiseTinyEdges();
581 //=============================================================================
583 * BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength
585 * Set Tiny Edge OptimisationLength
587 //=============================================================================
588 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength(CORBA::Double theValue) {
590 this->GetImpl()->SetTinyEdgeOptimisationLength(theValue);
591 SMESH::TPythonDump() << _this() << ".SetTinyEdgeOptimisationLength( " << theValue << " )";
594 //=============================================================================
596 * BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength
598 * Get Tiny Edge OptimisationLength
600 //=============================================================================
601 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength() {
603 return this->GetImpl()->GetTinyEdgeOptimisationLength();
606 //=============================================================================
608 * BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection
612 //=============================================================================
613 void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection(CORBA::Boolean theValue) {
615 this->GetImpl()->SetCorrectSurfaceIntersection(theValue);
616 std::string theValueStr = theValue ? "True" : "False";
617 SMESH::TPythonDump() << _this() << ".SetCorrectSurfaceIntersection( " << theValueStr.c_str() << " )";
620 //=============================================================================
622 * BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection
626 //=============================================================================
627 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection() {
629 return this->GetImpl()->GetCorrectSurfaceIntersection();
632 //=============================================================================
634 * BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost
636 * Set Tiny Edge OptimisationLength
638 //=============================================================================
639 void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost(CORBA::Double theValue) {
641 this->GetImpl()->SetCorrectSurfaceIntersectionMaxCost(theValue);
642 SMESH::TPythonDump() << _this() << ".SetCorrectSurfaceIntersectionMaxCost( " << theValue << " )";
645 //=============================================================================
647 * BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost
649 * Get Tiny Edge OptimisationLength
651 //=============================================================================
652 CORBA::Double BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost() {
654 return this->GetImpl()->GetCorrectSurfaceIntersectionMaxCost();
657 //=============================================================================
659 * BLSURFPlugin_Hypothesis_i::SetBadElementRemoval
663 //=============================================================================
664 void BLSURFPlugin_Hypothesis_i::SetBadElementRemoval(CORBA::Boolean theValue) {
666 this->GetImpl()->SetBadElementRemoval(theValue);
667 std::string theValueStr = theValue ? "True" : "False";
668 SMESH::TPythonDump() << _this() << ".SetBadElementRemoval( " << theValueStr.c_str() << " )";
671 //=============================================================================
673 * BLSURFPlugin_Hypothesis_i::GetBadElementRemoval
677 //=============================================================================
678 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetBadElementRemoval() {
680 return this->GetImpl()->GetBadElementRemoval();
683 //=============================================================================
685 * BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio
687 * Set Bad Surface Element Aspect Ratio
689 //=============================================================================
690 void BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio(CORBA::Double theValue) {
692 this->GetImpl()->SetBadElementAspectRatio(theValue);
693 SMESH::TPythonDump() << _this() << ".SetBadElementAspectRatio( " << theValue << " )";
696 //=============================================================================
698 * BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio
700 * Get Bad Surface Element Aspect Ratio
702 //=============================================================================
703 CORBA::Double BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio() {
705 return this->GetImpl()->GetBadElementAspectRatio();
708 //=============================================================================
710 * BLSURFPlugin_Hypothesis_i::SetOptimizeMesh
714 //=============================================================================
715 void BLSURFPlugin_Hypothesis_i::SetOptimizeMesh(CORBA::Boolean theValue) {
717 this->GetImpl()->SetOptimizeMesh(theValue);
718 std::string theValueStr = theValue ? "True" : "False";
719 SMESH::TPythonDump() << _this() << ".SetOptimizeMesh( " << theValueStr.c_str() << " )";
722 //=============================================================================
724 * BLSURFPlugin_Hypothesis_i::GetOptimizeMesh
728 //=============================================================================
729 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimizeMesh() {
731 return this->GetImpl()->GetOptimizeMesh();
734 //=============================================================================
736 * BLSURFPlugin_Hypothesis_i::SetQuadraticMesh
740 //=============================================================================
741 void BLSURFPlugin_Hypothesis_i::SetQuadraticMesh(CORBA::Boolean theValue) {
743 this->GetImpl()->SetQuadraticMesh(theValue);
744 std::string theValueStr = theValue ? "True" : "False";
745 SMESH::TPythonDump() << _this() << ".SetQuadraticMesh( " << theValueStr.c_str() << " )";
748 //=============================================================================
750 * BLSURFPlugin_Hypothesis_i::GetQuadraticMesh
754 //=============================================================================
755 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadraticMesh() {
757 return this->GetImpl()->GetQuadraticMesh();
765 * BLSURFPlugin_Hypothesis_i::SetTopology
770 //=============================================================================
771 void BLSURFPlugin_Hypothesis_i::SetTopology(CORBA::Long theValue) {
773 this->GetImpl()->SetTopology((::BLSURFPlugin_Hypothesis::Topology) theValue);
774 SMESH::TPythonDump() << _this() << ".SetTopology( " << theValue << " )";
777 //=============================================================================
779 * BLSURFPlugin_Hypothesis_i::GetTopology
783 //=============================================================================
784 CORBA::Long BLSURFPlugin_Hypothesis_i::GetTopology() {
786 return this->GetImpl()->GetTopology();
789 //=============================================================================
791 * Activate/deactivate surface proximity computation
793 void BLSURFPlugin_Hypothesis_i::SetSurfaceProximity( CORBA::Boolean toUse )
795 if ( GetSurfaceProximity() != toUse )
797 this->GetImpl()->SetUseSurfaceProximity( toUse );
798 SMESH::TPythonDump() << _this() << ".SetSurfaceProximity( " << toUse << " )";
802 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetSurfaceProximity()
804 return this->GetImpl()->GetUseSurfaceProximity();
807 //=============================================================================
809 * Set number of surface element layers to be generated due to surface proximity
811 void BLSURFPlugin_Hypothesis_i::SetNbSurfaceProximityLayers( CORBA::Short nbLayers )
813 if ( GetNbSurfaceProximityLayers() != nbLayers )
815 this->GetImpl()->SetNbSurfaceProximityLayers( nbLayers );
816 SMESH::TPythonDump() << _this() << ".SetNbSurfaceProximityLayers( " << nbLayers << " )";
820 CORBA::Short BLSURFPlugin_Hypothesis_i::GetNbSurfaceProximityLayers()
822 return this->GetImpl()->GetNbSurfaceProximityLayers();
825 //=============================================================================
827 * Set coefficient by which size of element refined due to surface proximity is increased
829 void BLSURFPlugin_Hypothesis_i::SetSurfaceProximityRatio( CORBA::Double ratio )
831 if ( GetSurfaceProximityRatio() != ratio )
833 this->GetImpl()->SetSurfaceProximityRatio( ratio );
834 SMESH::TPythonDump() << _this() << ".SetSurfaceProximityRatio( " << ratio << " )";
838 CORBA::Double BLSURFPlugin_Hypothesis_i::GetSurfaceProximityRatio()
840 return this->GetImpl()->GetSurfaceProximityRatio();
843 //=============================================================================
845 * Activate/deactivate volume proximity computation
847 void BLSURFPlugin_Hypothesis_i::SetVolumeProximity( CORBA::Boolean toUse )
849 if ( GetVolumeProximity() != toUse )
851 this->GetImpl()->SetUseVolumeProximity( toUse );
852 SMESH::TPythonDump() << _this() << ".SetVolumeProximity( " << toUse << " )";
856 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetVolumeProximity()
858 return this->GetImpl()->GetUseVolumeProximity();
862 //=============================================================================
864 * Set number of surface element layers to be generated due to volume proximity
866 void BLSURFPlugin_Hypothesis_i::SetNbVolumeProximityLayers( CORBA::Short nbLayers )
868 if ( GetNbVolumeProximityLayers() != nbLayers )
870 this->GetImpl()->SetNbVolumeProximityLayers( nbLayers );
871 SMESH::TPythonDump() << _this() << ".SetNbVolumeProximityLayers( " << nbLayers << " )";
875 CORBA::Short BLSURFPlugin_Hypothesis_i::GetNbVolumeProximityLayers()
877 return this->GetImpl()->GetNbVolumeProximityLayers();
880 //=============================================================================
882 * Set coefficient by which size of element refined due to volume proximity is increased
884 void BLSURFPlugin_Hypothesis_i::SetVolumeProximityRatio( CORBA::Double ratio )
886 if ( GetVolumeProximityRatio() != ratio )
888 this->GetImpl()->SetVolumeProximityRatio( ratio );
889 SMESH::TPythonDump() << _this() << ".SetVolumeProximityRatio( " << ratio << " )";
893 CORBA::Double BLSURFPlugin_Hypothesis_i::GetVolumeProximityRatio()
895 return this->GetImpl()->GetVolumeProximityRatio();
898 //=============================================================================
899 void BLSURFPlugin_Hypothesis_i::SetVerbosity(CORBA::Short theVal) throw (SALOME::SALOME_Exception) {
901 if (theVal < 0 || theVal > 100)
902 THROW_SALOME_CORBA_EXCEPTION( "Invalid verbosity level",SALOME::BAD_PARAM );
903 this->GetImpl()->SetVerbosity(theVal);
904 SMESH::TPythonDump() << _this() << ".SetVerbosity( " << theVal << " )";
907 //=============================================================================
909 CORBA::Short BLSURFPlugin_Hypothesis_i::GetVerbosity() {
911 return (CORBA::Short) this->GetImpl()->GetVerbosity();
914 //=============================================================================
915 void BLSURFPlugin_Hypothesis_i::SetEnforceCadEdgesSize( CORBA::Boolean toEnforce )
917 if ( GetEnforceCadEdgesSize() != toEnforce )
919 this->GetImpl()->SetEnforceCadEdgesSize(toEnforce);
920 SMESH::TPythonDump() << _this() << ".SetEnforceCadEdgesSize( " << toEnforce << " )";
923 //=============================================================================
924 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetEnforceCadEdgesSize()
926 return this->GetImpl()->GetEnforceCadEdgesSize();
928 //=============================================================================
930 void BLSURFPlugin_Hypothesis_i::SetJacobianRectificationRespectGeometry( CORBA::Boolean allowRectification )
932 if ( GetJacobianRectificationRespectGeometry() != allowRectification )
934 this->GetImpl()->SetJacobianRectificationRespectGeometry(allowRectification);
935 SMESH::TPythonDump() << _this() << ".SetJacobianRectificationRespectGeometry( " << allowRectification << " )";
938 //=============================================================================
939 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetJacobianRectificationRespectGeometry()
941 return this->GetImpl()->GetJacobianRectificationRespectGeometry();
943 //=============================================================================
945 void BLSURFPlugin_Hypothesis_i::SetJacobianRectification( CORBA::Boolean allowRectification )
947 if ( GetJacobianRectification() != allowRectification )
949 this->GetImpl()->SetJacobianRectification(allowRectification);
950 SMESH::TPythonDump() << _this() << ".SetJacobianRectification( " << allowRectification << " )";
953 //=============================================================================
954 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetJacobianRectification()
956 return this->GetImpl()->GetJacobianRectification();
958 //=============================================================================
960 void BLSURFPlugin_Hypothesis_i::SetUseDeprecatedPatchMesher( CORBA::Boolean useDeprecatedPatchMesher )
962 if ( GetUseDeprecatedPatchMesher() != useDeprecatedPatchMesher )
964 this->GetImpl()->SetUseDeprecatedPatchMesher(useDeprecatedPatchMesher);
965 SMESH::TPythonDump() << _this() << ".SetUseDeprecatedPatchMesher( " << useDeprecatedPatchMesher << " )";
968 //=============================================================================
969 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseDeprecatedPatchMesher()
971 return this->GetImpl()->GetUseDeprecatedPatchMesher();
973 //=============================================================================
975 void BLSURFPlugin_Hypothesis_i::SetMaxNumberOfPointsPerPatch( CORBA::Long nb ) throw (SALOME::SALOME_Exception)
977 if ( GetMaxNumberOfPointsPerPatch() != nb )
980 this->GetImpl()->SetMaxNumberOfPointsPerPatch(nb);
982 } catch (const std::invalid_argument& ex) {
983 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
984 } catch (SALOME_Exception& ex) {
985 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
987 SMESH::TPythonDump() << _this() << ".SetMaxNumberOfPointsPerPatch( " << nb << " )";
990 //=============================================================================
991 CORBA::Long BLSURFPlugin_Hypothesis_i::GetMaxNumberOfPointsPerPatch()
993 return this->GetImpl()->GetMaxNumberOfPointsPerPatch();
995 //=============================================================================
997 void BLSURFPlugin_Hypothesis_i::SetMaxNumberOfThreads( CORBA::Long nb ) throw (SALOME::SALOME_Exception)
999 if ( GetMaxNumberOfThreads() != nb )
1002 this->GetImpl()->SetMaxNumberOfThreads(nb);
1004 } catch (const std::invalid_argument& ex) {
1005 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1006 } catch (SALOME_Exception& ex) {
1007 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1009 SMESH::TPythonDump() << _this() << ".SetMaxNumberOfThreads( " << nb << " )";
1012 //=============================================================================
1013 CORBA::Long BLSURFPlugin_Hypothesis_i::GetMaxNumberOfThreads()
1015 return this->GetImpl()->GetMaxNumberOfThreads();
1017 //=============================================================================
1019 void BLSURFPlugin_Hypothesis_i::SetRespectGeometry( CORBA::Boolean toRespect )
1021 if ( GetRespectGeometry() != toRespect )
1023 this->GetImpl()->SetRespectGeometry(toRespect);
1024 SMESH::TPythonDump() << _this() << ".SetRespectGeometry( " << toRespect << " )";
1027 //=============================================================================
1028 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRespectGeometry()
1030 return this->GetImpl()->GetRespectGeometry();
1032 //=============================================================================
1034 void BLSURFPlugin_Hypothesis_i::SetTinyEdgesAvoidSurfaceIntersections( CORBA::Boolean toAvoidIntersection )
1036 if ( GetTinyEdgesAvoidSurfaceIntersections() != toAvoidIntersection )
1038 this->GetImpl()->SetTinyEdgesAvoidSurfaceIntersections(toAvoidIntersection);
1039 SMESH::TPythonDump() << _this() << ".SetTinyEdgesAvoidSurfaceIntersections( " << toAvoidIntersection << " )";
1042 //=============================================================================
1043 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetTinyEdgesAvoidSurfaceIntersections()
1045 return this->GetImpl()->GetTinyEdgesAvoidSurfaceIntersections();
1047 //=============================================================================
1049 void BLSURFPlugin_Hypothesis_i::SetClosedGeometry( CORBA::Boolean isClosed )
1051 if ( GetClosedGeometry() != isClosed )
1053 this->GetImpl()->SetClosedGeometry(isClosed);
1054 SMESH::TPythonDump() << _this() << ".SetClosedGeometry( " << isClosed << " )";
1057 //=============================================================================
1058 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetClosedGeometry()
1060 return this->GetImpl()->GetClosedGeometry();
1062 //=============================================================================
1064 void BLSURFPlugin_Hypothesis_i::SetDebug( CORBA::Boolean isDebug )
1066 if ( GetDebug() != isDebug )
1068 this->GetImpl()->SetDebug(isDebug);
1069 SMESH::TPythonDump() << _this() << ".SetDebug( " << isDebug << " )";
1072 //=============================================================================
1073 bool BLSURFPlugin_Hypothesis_i::GetDebug()
1075 return this->GetImpl()->GetDebug();
1077 //=============================================================================
1079 void BLSURFPlugin_Hypothesis_i::SetPeriodicTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception)
1082 if ( GetImpl()->GetPreCADOptionValue("periodic_tolerance",&isDefault) != SMESH_Comment( tol ))
1086 this->GetImpl()->SetPeriodicTolerance(tol);
1088 } catch (const std::invalid_argument& ex) {
1089 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1090 } catch (SALOME_Exception& ex) {
1091 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1093 SMESH::TPythonDump() << _this() << ".SetPeriodicTolerance( " << tol << " )";
1096 //=============================================================================
1097 double BLSURFPlugin_Hypothesis_i::GetPeriodicTolerance() throw (SALOME::SALOME_Exception)
1100 return this->GetImpl()->GetPeriodicTolerance();
1102 } catch (const std::invalid_argument& ex) {
1103 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1104 } catch (SALOME_Exception& ex) {
1105 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1109 //=============================================================================
1111 void BLSURFPlugin_Hypothesis_i::SetRequiredEntities( const char* howToTreat ) throw (SALOME::SALOME_Exception)
1113 if ( GetImpl()->GetRequiredEntities() != howToTreat )
1116 this->GetImpl()->SetRequiredEntities(howToTreat);
1118 } catch (const std::invalid_argument& ex) {
1119 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1120 } catch (SALOME_Exception& ex) {
1121 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1123 SMESH::TPythonDump() << _this() << ".SetRequiredEntities( '" << howToTreat << "' )";
1126 //=============================================================================
1127 char* BLSURFPlugin_Hypothesis_i::GetRequiredEntities()
1129 return CORBA::string_dup( this->GetImpl()->GetRequiredEntities().c_str() );
1131 //=============================================================================
1133 void BLSURFPlugin_Hypothesis_i::SetSewingTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception)
1136 if ( GetImpl()->GetPreCADOptionValue("sewing_tolerance",&isDefault) != SMESH_Comment( tol ))
1140 this->GetImpl()->SetSewingTolerance(tol);
1141 SMESH::TPythonDump() << _this() << ".SetSewingTolerance( " << tol << " )";
1143 } catch (const std::invalid_argument& ex) {
1144 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1145 } catch (SALOME_Exception& ex) {
1146 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1150 //=============================================================================
1151 CORBA::Double BLSURFPlugin_Hypothesis_i::GetSewingTolerance() throw (SALOME::SALOME_Exception)
1155 return this->GetImpl()->GetSewingTolerance();
1157 } catch (const std::invalid_argument& ex) {
1158 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1159 } catch (SALOME_Exception& ex) {
1160 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1164 //=============================================================================
1166 void BLSURFPlugin_Hypothesis_i::SetTags( const char* howToTreat ) throw (SALOME::SALOME_Exception)
1168 if ( GetImpl()->GetTags() != howToTreat )
1171 this->GetImpl()->SetTags(howToTreat);
1173 catch (const std::invalid_argument& ex) {
1174 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1175 } catch (SALOME_Exception& ex) {
1176 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1179 SMESH::TPythonDump() << _this() << ".SetTags( '" << howToTreat << "' )";
1181 //=============================================================================
1182 char* BLSURFPlugin_Hypothesis_i::GetTags()
1184 return CORBA::string_dup( this->GetImpl()->GetTags().c_str() );
1187 //=============================================================================
1188 void BLSURFPlugin_Hypothesis_i::SetHyperPatches(const BLSURFPlugin::THyperPatchList& hpl)
1190 ::BLSURFPlugin_Hypothesis::THyperPatchList patchList( hpl.length() );
1191 SMESH_Comment hplDump;
1193 for ( size_t i = 0; i < patchList.size(); ++i )
1196 BLSURFPlugin::THyperPatch tags = hpl[ i ];
1197 for ( CORBA::ULong j = 0; j < tags.length(); ++j )
1199 patchList[ i ].insert( tags[ j ]);
1200 hplDump << tags[ j ] << ( j+1 < tags.length() ? ", " : " ]" );
1202 hplDump << ( i+1 < patchList.size() ? "," : "]");
1204 if ( GetImpl()->GetHyperPatches() != patchList )
1206 GetImpl()->SetHyperPatches( patchList );
1207 SMESH::TPythonDump() << _this() << ".SetHyperPatches( " << hplDump << " )";
1211 //=============================================================================
1212 BLSURFPlugin::THyperPatchList* BLSURFPlugin_Hypothesis_i::GetHyperPatches()
1214 const ::BLSURFPlugin_Hypothesis::THyperPatchList& hpl = GetImpl()->GetHyperPatches();
1215 BLSURFPlugin::THyperPatchList* resHpl = new BLSURFPlugin::THyperPatchList();
1216 resHpl->length( hpl.size() );
1218 ::BLSURFPlugin_Hypothesis::THyperPatchList::const_iterator hpIt = hpl.begin();
1219 for ( int i = 0; hpIt != hpl.end(); ++hpIt, ++i )
1221 const ::BLSURFPlugin_Hypothesis::THyperPatchTags& hp = *hpIt;
1222 BLSURFPlugin::THyperPatch& resHp = (*resHpl)[ i ];
1223 resHp.length( hp.size() );
1225 ::BLSURFPlugin_Hypothesis::THyperPatchTags::const_iterator tag = hp.begin();
1226 for ( int j = 0; tag != hp.end(); ++tag, ++j )
1232 //=============================================================================
1234 * BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges
1238 //=============================================================================
1239 void BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges(CORBA::Boolean theValue) {
1241 this->GetImpl()->SetPreCADMergeEdges(theValue);
1242 std::string theValueStr = theValue ? "True" : "False";
1243 SMESH::TPythonDump() << _this() << ".SetPreCADMergeEdges( " << theValueStr.c_str() << " )";
1246 //=============================================================================
1248 * BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges
1252 //=============================================================================
1253 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges() {
1255 return this->GetImpl()->GetPreCADMergeEdges();
1258 //=============================================================================
1260 * BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces
1264 //=============================================================================
1265 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue) {
1267 this->GetImpl()->SetPreCADRemoveDuplicateCADFaces(theValue);
1268 std::string theValueStr = theValue ? "True" : "False";
1269 SMESH::TPythonDump() << _this() << ".SetPreCADRemoveDuplicateCADFaces( " << theValueStr.c_str() << " )";
1272 //=============================================================================
1274 * BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces
1278 //=============================================================================
1279 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces() {
1281 return this->GetImpl()->GetPreCADRemoveDuplicateCADFaces();
1284 //=============================================================================
1286 * BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology
1290 //=============================================================================
1291 void BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology(CORBA::Boolean theValue) {
1293 this->GetImpl()->SetPreCADProcess3DTopology(theValue);
1294 std::string theValueStr = theValue ? "True" : "False";
1295 SMESH::TPythonDump() << _this() << ".SetPreCADProcess3DTopology( " << theValueStr.c_str() << " )";
1298 //=============================================================================
1300 * BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology
1304 //=============================================================================
1305 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology() {
1307 return this->GetImpl()->GetPreCADProcess3DTopology();
1310 //=============================================================================
1312 * BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput
1316 //=============================================================================
1317 void BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput(CORBA::Boolean theValue) {
1319 this->GetImpl()->SetPreCADDiscardInput(theValue);
1320 std::string theValueStr = theValue ? "True" : "False";
1321 SMESH::TPythonDump() << _this() << ".SetPreCADDiscardInput( " << theValueStr.c_str() << " )";
1324 //=============================================================================
1326 * BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput
1330 //=============================================================================
1331 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput() {
1333 return this->GetImpl()->GetPreCADDiscardInput();
1337 //=============================================================================
1339 void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
1340 throw (SALOME::SALOME_Exception) {
1343 std::string name( optionName );
1344 if ( !optionValue || !optionValue[0] )
1345 UnsetOption( optionName );
1347 // basic options (visible in Advanced table)
1349 else if ( name == "enforce_cad_edge_sizes" )
1350 SetEnforceCadEdgesSize( GetImpl()->ToBool( optionValue ));
1352 else if ( name == "jacobian_rectification_respect_geometry" )
1353 SetJacobianRectificationRespectGeometry( GetImpl()->ToBool( optionValue ));
1355 else if ( name == "max_number_of_points_per_patch" )
1356 SetMaxNumberOfPointsPerPatch( GetImpl()->ToInt( optionValue ));
1358 else if ( name == "max_number_of_threads" )
1359 SetMaxNumberOfThreads( GetImpl()->ToInt( optionValue ));
1361 else if ( name == "rectify_jacobian" )
1362 SetJacobianRectification( GetImpl()->ToBool( optionValue ));
1364 else if ( name == "use_deprecated_patch_mesher" )
1365 SetUseDeprecatedPatchMesher( GetImpl()->ToBool( optionValue ));
1367 else if ( name == "respect_geometry" )
1368 SetRespectGeometry( GetImpl()->ToBool( optionValue ));
1370 else if ( name == "tiny_edge_avoid_surface_intersections" )
1371 SetTinyEdgesAvoidSurfaceIntersections( GetImpl()->ToBool( optionValue ));
1373 else if ( name == "closed_geometry" )
1374 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1376 else if ( name == "debug" )
1377 SetDebug( GetImpl()->ToBool( optionValue ));
1379 else if ( name == "discard_input_topology" )
1380 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1382 else if ( name == "merge_edges" )
1383 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1385 else if ( name == "periodic_tolerance" )
1386 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1388 else if ( name == "remove_duplicate_cad_faces" )
1389 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1391 else if ( name == "required_entities" )
1392 SetRequiredEntities( optionValue );
1394 else if ( name == "sewing_tolerance" )
1395 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1397 else if ( name == "tags" )
1398 SetTags( optionValue );
1400 // other basic options with specific methods
1402 else if ( name == "correct_surface_intersections" )
1403 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1405 else if ( name == "optimise_tiny_edges" )
1406 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1408 else if ( name == "surface_intersections_processing_max_cost" )
1409 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1411 else if ( name == "volume_gradation" )
1412 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1414 else if ( name == "tiny_edge_optimisation_length" )
1415 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1417 else if ( name == "proximity" )
1418 SetVolumeProximity( GetImpl()->ToBool( optionValue ));
1420 else if ( name == "prox_ratio" )
1421 SetVolumeProximityRatio( GetImpl()->ToDbl( optionValue ));
1423 else if ( name == "prox_nb_layer" )
1424 SetNbVolumeProximityLayers( GetImpl()->ToInt( optionValue ));
1426 // advanced options (for backward compatibility)
1428 else if ( name == "create_tag_on_collision" ||
1429 name == "tiny_edge_respect_geometry" )
1430 AddOption( optionName, optionValue );
1434 valueChanged = ( this->GetImpl()->GetOptionValue( name ) != optionValue &&
1435 this->GetImpl()->GetOptionValue( name, &valueChanged ) != optionValue );
1438 this->GetImpl()->SetOptionValue(optionName, optionValue);
1439 SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
1442 } catch (const std::invalid_argument& ex) {
1443 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1444 } catch (SALOME_Exception& ex) {
1445 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1449 //=============================================================================
1451 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, const char* optionValue)
1452 throw (SALOME::SALOME_Exception) {
1454 bool valueChanged = false;
1456 std::string name( optionName );
1457 if ( !optionValue || !optionValue[0] )
1458 UnsetOption( optionName );
1460 else if ( name == "closed_geometry" )
1461 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1463 else if ( name == "debug" )
1464 SetDebug( GetImpl()->ToBool( optionValue ));
1466 else if ( name == "discard_input_topology" )
1467 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1469 else if ( name == "merge_edges" )
1470 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1472 else if ( name == "periodic_tolerance" )
1473 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1475 else if ( name == "remove_duplicate_cad_faces" )
1476 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1478 else if ( name == "required_entities" )
1479 SetRequiredEntities( optionValue );
1481 else if ( name == "sewing_tolerance" )
1482 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1484 else if ( name == "tags" )
1485 SetTags( optionValue );
1487 // other basic options with specific methods
1489 else if ( name == "correct_surface_intersections" )
1490 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1492 else if ( name == "optimise_tiny_edges" )
1493 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1495 else if ( name == "surface_intersections_processing_max_cost" )
1496 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1498 else if ( name == "volume_gradation" )
1499 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1501 else if ( name == "tiny_edge_optimisation_length" )
1502 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1504 else if ( name == "process_3d_topology" )
1505 SetPreCADProcess3DTopology( GetImpl()->ToBool( optionValue ));
1507 // advanced options (for backward compatibility)
1509 else if ( name == "create_tag_on_collision" ||
1510 name == "tiny_edge_respect_geometry" ||
1511 name == "remove_tiny_edges" ||
1512 name == "tiny_edge_length")
1513 AddPreCADOption( optionName, optionValue );
1516 valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue);
1518 this->GetImpl()->SetPreCADOptionValue(optionName, optionValue);
1520 } catch (const std::invalid_argument& ex) {
1521 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1522 } catch (SALOME_Exception& ex) {
1523 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1526 SMESH::TPythonDump() << _this() << ".SetPreCADOptionValue( '" << optionName << "', '" << optionValue << "' )";
1529 //=============================================================================
1531 char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1535 return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName,&isDefault).c_str());
1536 } catch (const std::invalid_argument& ex) {
1537 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1538 } catch (SALOME_Exception& ex) {
1539 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1544 //=============================================================================
1546 char* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1550 return CORBA::string_dup(this->GetImpl()->GetPreCADOptionValue(optionName,&isDefault).c_str());
1551 } catch (const std::invalid_argument& ex) {
1552 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1553 } catch (SALOME_Exception& ex) {
1554 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1559 //=============================================================================
1561 void BLSURFPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
1563 if ( !GetImpl()->GetOptionValue( optionName ).empty() )
1565 this->GetImpl()->ClearOption(optionName);
1566 SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
1570 //=============================================================================
1572 void BLSURFPlugin_Hypothesis_i::UnsetPreCADOption(const char* optionName) {
1574 if ( !GetImpl()->GetPreCADOptionValue( optionName ).empty() )
1576 this->GetImpl()->ClearPreCADOption(optionName);
1577 SMESH::TPythonDump() << _this() << ".UnsetPreCADOption( '" << optionName << "' )";
1581 //=============================================================================
1583 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() {
1585 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1587 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
1588 result->length(opts.size());
1592 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1593 for (; opIt != opts.end(); ++opIt, ++i) {
1594 string name_value_type = opIt->first;
1595 if (!opIt->second.empty()) {
1596 name_value_type += ":";
1597 name_value_type += GetImpl()->GetOptionValue( opIt->first, &isDefault );
1598 name_value_type += isDefault ? ":0" : ":1";
1600 result[i] = CORBA::string_dup(name_value_type.c_str());
1603 return result._retn();
1606 //=============================================================================
1608 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() {
1610 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1612 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
1613 result->length(opts.size());
1617 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1618 for (; opIt != opts.end(); ++opIt, ++i) {
1619 string name_value_type = opIt->first;
1620 if (!opIt->second.empty()) {
1621 name_value_type += ":";
1622 name_value_type += GetImpl()->GetPreCADOptionValue( opIt->first, &isDefault );
1623 name_value_type += isDefault ? ":0" : ":1";
1625 result[i] = CORBA::string_dup(name_value_type.c_str());
1627 return result._retn();
1630 //=============================================================================
1632 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAdvancedOptionValues()
1634 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1636 const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
1637 result->length(custom_opts.size());
1640 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = custom_opts.begin();
1641 for (; opIt != custom_opts.end(); ++opIt, ++i) {
1642 string name_value_type = opIt->first;
1643 if (!opIt->second.empty()) {
1644 name_value_type += ":";
1645 name_value_type += opIt->second;
1646 name_value_type += ":1"; // user defined
1648 result[i] = CORBA::string_dup(name_value_type.c_str());
1650 return result._retn();
1653 //=============================================================================
1655 void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
1656 throw (SALOME::SALOME_Exception) {
1658 for (CORBA::ULong i = 0; i < options.length(); ++i) {
1659 string name_value_type = options[i].in();
1660 if(name_value_type.empty())
1662 size_t colonPos = name_value_type.find(':');
1664 if (colonPos == string::npos) // ':' not found
1665 name = name_value_type;
1667 name = name_value_type.substr(0, colonPos);
1668 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1669 string value_type = name_value_type.substr(colonPos + 1);
1670 colonPos = value_type.find(':');
1671 value = value_type.substr(0, colonPos);
1672 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1673 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1677 SetOptionValue(name.c_str(), value.c_str());
1681 //=============================================================================
1683 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string_array& options)
1684 throw (SALOME::SALOME_Exception) {
1686 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1687 string name_value_type = options[i].in();
1688 if(name_value_type.empty())
1690 size_t colonPos = name_value_type.find(':');
1692 if (colonPos == string::npos) // ':' not found
1693 name = name_value_type;
1695 name = name_value_type.substr(0, colonPos);
1696 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1697 string value_type = name_value_type.substr(colonPos + 1);
1698 colonPos = value_type.find(':');
1699 value = value_type.substr(0, colonPos);
1700 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1701 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1705 SetPreCADOptionValue(name.c_str(), value.c_str());
1709 //=============================================================================
1711 void BLSURFPlugin_Hypothesis_i::SetAdvancedOptionValues(const BLSURFPlugin::string_array& options)
1713 SMESH::TPythonDump dump;
1715 string optionsAndValues;
1716 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1717 string name_value_type = options[i].in();
1718 if(name_value_type.empty())
1720 size_t colonPos = name_value_type.find(':');
1722 if (colonPos == string::npos) // ':' not found
1723 name = name_value_type;
1725 name = name_value_type.substr(0, colonPos);
1726 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1727 string value_type = name_value_type.substr(colonPos + 1);
1728 colonPos = value_type.find(':');
1729 value = value_type.substr(0, colonPos);
1732 AddOption(name.c_str(), value.c_str());
1734 optionsAndValues += name + " " + value + " ";
1737 if ( !optionsAndValues.empty() )
1738 dump << _this() << ".SetAdvancedOptions( '" << optionsAndValues.c_str() << "' )";
1741 //=============================================================================
1743 void BLSURFPlugin_Hypothesis_i::SetAdvancedOption(const char* optionsAndValues)
1744 throw (SALOME::SALOME_Exception)
1746 if ( !optionsAndValues ) return;
1748 SMESH::TPythonDump dump;
1750 std::istringstream strm( optionsAndValues );
1751 std::istream_iterator<std::string> sIt( strm ), sEnd;
1752 while ( sIt != sEnd )
1754 std::string option = *sIt;
1755 if ( ++sIt != sEnd )
1757 std::string value = *sIt;
1759 AddOption( option.c_str(), value.c_str() );
1763 THROW_SALOME_CORBA_EXCEPTION( "Uneven number of options and values" ,SALOME::BAD_PARAM );
1766 dump << _this() << ".SetAdvancedOption( '" << optionsAndValues << "' )";
1769 //=============================================================================
1771 void BLSURFPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
1773 // backward compatibility
1775 std::string name( optionName );
1776 if ( name == "proximity" )
1777 SetVolumeProximity( GetImpl()->ToBool( optionValue ));
1779 else if ( name == "prox_ratio" )
1780 SetVolumeProximityRatio( GetImpl()->ToDbl( optionValue ));
1782 else if ( name == "prox_nb_layer" )
1783 SetNbVolumeProximityLayers( GetImpl()->ToInt( optionValue ));
1785 bool valueChanged = (this->GetImpl()->GetOption(optionName) != optionValue);
1787 this->GetImpl()->AddOption(optionName, optionValue);
1788 SMESH::TPythonDump() << _this() << ".AddOption( '" << optionName << "', '" << optionValue << "' )";
1792 //=============================================================================
1794 void BLSURFPlugin_Hypothesis_i::AddPreCADOption(const char* optionName, const char* optionValue)
1797 bool valueChanged = (this->GetImpl()->GetPreCADOption(optionName) != optionValue);
1799 this->GetImpl()->AddPreCADOption(optionName, optionValue);
1800 SMESH::TPythonDump() << _this() << ".AddPreCADOption( '" << optionName << "', '" << optionValue << "' )";
1804 //=============================================================================
1806 char* BLSURFPlugin_Hypothesis_i::GetOption(const char* optionName)
1809 return CORBA::string_dup(this->GetImpl()->GetOption(optionName).c_str());
1812 //=============================================================================
1814 char* BLSURFPlugin_Hypothesis_i::GetPreCADOption(const char* optionName)
1817 return CORBA::string_dup(this->GetImpl()->GetPreCADOption(optionName).c_str());
1820 //=============================================================================
1822 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
1823 throw (SALOME::SALOME_Exception) {
1825 if ( !entry || !entry[0] )
1826 THROW_SALOME_CORBA_EXCEPTION( "SetSizeMapEntry(): empty geom entry", SALOME::BAD_PARAM );
1827 bool valueChanged = false;
1829 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap);
1831 this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
1832 } catch (const std::invalid_argument& ex) {
1833 SALOME::ExceptionStruct ExDescription;
1834 ExDescription.text = ex.what();
1835 ExDescription.type = SALOME::BAD_PARAM;
1836 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1837 ExDescription.lineNumber = 0;
1838 throw SALOME::SALOME_Exception(ExDescription);
1839 } catch (SALOME_Exception& ex) {
1840 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1843 SMESH::TPythonDump() << _this() << ".SetSizeMap(" << entry << ", '" << sizeMap << "' )";
1846 //=============================================================================
1848 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap)
1849 throw (SALOME::SALOME_Exception) {
1851 bool valueChanged = false;
1852 std::ostringstream sizeMapFunction;
1853 switch (shapeType) {
1854 case GEOM::FACE: sizeMapFunction << "def f(u,v): return " << sizeMap ; break;
1855 case GEOM::EDGE: sizeMapFunction << "def f(t): return " << sizeMap ; break;
1856 case GEOM::VERTEX: sizeMapFunction << "def f(): return " << sizeMap ; break;
1860 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str());
1862 this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str());
1863 } catch (const std::invalid_argument& ex) {
1864 SALOME::ExceptionStruct ExDescription;
1865 ExDescription.text = ex.what();
1866 ExDescription.type = SALOME::BAD_PARAM;
1867 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1868 ExDescription.lineNumber = 0;
1869 throw SALOME::SALOME_Exception(ExDescription);
1870 } catch (SALOME_Exception& ex) {
1871 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1874 SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", " << sizeMap << " )";
1877 //=============================================================================
1879 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
1880 throw (SALOME::SALOME_Exception) {
1882 bool valueChanged = false;
1884 valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
1885 if ( valueChanged ) {
1886 boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
1887 if (!boost::regex_match(string(attractor), re))
1888 throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
1889 this->GetImpl()->SetAttractorEntry(entry, attractor);
1891 } catch (const std::invalid_argument& ex) {
1892 SALOME::ExceptionStruct ExDescription;
1893 ExDescription.text = ex.what();
1894 ExDescription.type = SALOME::BAD_PARAM;
1895 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
1896 ExDescription.lineNumber = 0;
1897 throw SALOME::SALOME_Exception(ExDescription);
1898 } catch (SALOME_Exception& ex) {
1899 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1902 SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
1905 //=============================================================================
1907 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
1908 throw (SALOME::SALOME_Exception)
1911 //bool valueChanged = false;
1913 this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
1915 catch (const std::invalid_argument& ex) {
1916 SALOME::ExceptionStruct ExDescription;
1917 ExDescription.text = ex.what();
1918 ExDescription.type = SALOME::BAD_PARAM;
1919 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
1920 ExDescription.lineNumber = 0;
1921 throw SALOME::SALOME_Exception(ExDescription);
1922 } catch (SALOME_Exception& ex) {
1923 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1925 //if ( valueChanged )
1926 SMESH::TPythonDump() << _this() << ".SetAttractorGeom( "
1927 << entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
1930 //=============================================================================
1932 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1935 return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
1936 } catch (const std::invalid_argument& ex) {
1937 SALOME::ExceptionStruct ExDescription;
1938 ExDescription.text = ex.what();
1939 ExDescription.type = SALOME::BAD_PARAM;
1940 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
1941 ExDescription.lineNumber = 0;
1942 throw SALOME::SALOME_Exception(ExDescription);
1943 } catch (SALOME_Exception& ex) {
1944 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1949 //=============================================================================
1951 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1954 return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
1955 } catch (const std::invalid_argument& ex) {
1956 SALOME::ExceptionStruct ExDescription;
1957 ExDescription.text = ex.what();
1958 ExDescription.type = SALOME::BAD_PARAM;
1959 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
1960 ExDescription.lineNumber = 0;
1961 throw SALOME::SALOME_Exception(ExDescription);
1962 } catch (SALOME_Exception& ex) {
1963 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1968 // //=============================================================================
1970 // // TODO coder cette fonction (utilis??e pour savoir si la valeur a chang??
1971 // // A finir pour le dump
1972 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
1973 // throw (SALOME::SALOME_Exception)
1975 // ASSERT(myBaseImpl);
1977 // return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
1979 // catch (const std::invalid_argument& ex) {
1980 // SALOME::ExceptionStruct ExDescription;
1981 // ExDescription.text = ex.what();
1982 // ExDescription.type = SALOME::BAD_PARAM;
1983 // ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
1984 // ExDescription.lineNumber = 0;
1985 // throw SALOME::SALOME_Exception(ExDescription);
1987 // catch (SALOME_Exception& ex) {
1988 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1993 //=============================================================================
1995 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
1997 this->GetImpl()->ClearEntry(entry);
1998 // SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
2001 //=============================================================================
2003 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
2005 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
2007 const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
2008 result->length(sizeMaps.size());
2010 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
2011 for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
2012 string entry_sizemap = smIt->first;
2013 if (!smIt->second.empty()) {
2014 entry_sizemap += "|";
2015 entry_sizemap += smIt->second;
2017 result[i] = CORBA::string_dup(entry_sizemap.c_str());
2019 return result._retn();
2022 //=============================================================================
2024 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
2026 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
2028 const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
2029 result->length(attractors.size());
2031 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
2032 for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
2033 string entry_attractor = atIt->first;
2034 if (!atIt->second.empty()) {
2035 entry_attractor += "|";
2036 entry_attractor += atIt->second;
2038 result[i] = CORBA::string_dup(entry_attractor.c_str());
2040 return result._retn();
2043 //=============================================================================
2045 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
2048 BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
2050 const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
2051 result->length( attractors.size() );
2053 ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
2054 for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
2055 string faceEntry = atIt->first;
2057 double startSize, endSize, infDist, constDist;
2058 if ( !atIt->second->Empty() ) {
2059 attEntry = atIt->second->GetAttractorEntry();
2060 std::vector<double> params = atIt->second->GetParameters();
2061 startSize = params[0];
2062 endSize = params[1];
2063 infDist = params[2];
2064 constDist = params[3];
2066 result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
2067 result[i].attEntry = CORBA::string_dup(attEntry.c_str());
2068 result[i].startSize = startSize;
2069 result[i].endSize = endSize;
2070 result[i].infDist = infDist;
2071 result[i].constDist = constDist;
2073 return result._retn();
2076 //=============================================================================
2078 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
2079 throw (SALOME::SALOME_Exception) {
2081 for ( CORBA::ULong i = 0; i < sizeMaps.length(); ++i) {
2082 string entry_sizemap = sizeMaps[i].in();
2083 size_t colonPos = entry_sizemap.find('|');
2084 string entry, sizemap;
2085 if (colonPos == string::npos) // '|' separator not found
2086 entry = entry_sizemap;
2088 entry = entry_sizemap.substr(0, colonPos);
2089 if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
2090 sizemap = entry_sizemap.substr(colonPos + 1);
2092 this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
2096 //=============================================================================
2098 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
2100 this->GetImpl()->ClearSizeMaps();
2103 //=============================================================================
2105 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
2106 throw (SALOME::SALOME_Exception)
2110 entry = GeomObj->GetStudyEntry();
2111 SetSizeMapEntry(entry.c_str(), sizeMap);
2114 //=============================================================================
2116 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) {
2118 string entry = GeomObj->GetStudyEntry();
2119 GEOM::shape_type shapeType = GeomObj->GetShapeType();
2120 if (shapeType == GEOM::COMPOUND)
2121 shapeType = GeomObj->GetMaxShapeType();
2122 SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
2125 //=============================================================================
2126 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
2129 entry = GeomObj->GetStudyEntry();
2130 UnsetEntry(entry.c_str());
2131 SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
2134 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
2137 entry = GeomObj->GetStudyEntry();
2138 SetAttractorEntry(entry.c_str(), attractor);
2141 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
2144 entry = GeomObj->GetStudyEntry();
2145 UnsetEntry(entry.c_str());
2146 SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
2149 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)
2152 string theFaceEntry;
2154 theFaceEntry = theFace->GetStudyEntry();
2155 theAttEntry = theAttractor->GetStudyEntry();
2157 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2160 if (theFaceEntry.empty()) {
2162 aName += theFace->GetEntry();
2163 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2164 if (!theSFace->_is_nil())
2165 theFaceEntry = theSFace->GetID();
2167 if (theFaceEntry.empty())
2168 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2170 if (theAttEntry.empty()) {
2171 if (theAttractor->GetShapeType() == GEOM::VERTEX)
2173 if (theAttractor->GetShapeType() == GEOM::EDGE)
2175 if (theAttractor->GetShapeType() == GEOM::WIRE)
2177 if (theAttractor->GetShapeType() == GEOM::COMPOUND)
2178 aName = "Compound_";
2179 aName += theAttractor->GetEntry();
2180 SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(NULL, theAttractor, aName.c_str());
2181 if (!theSAtt->_is_nil())
2182 theAttEntry = theSAtt->GetID();
2184 if (theAttEntry.empty())
2185 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2187 TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
2188 TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
2189 SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
2192 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
2193 GEOM::GEOM_Object_ptr theAttractor)
2196 CORBA::String_var theFaceEntry = theFace->GetStudyEntry();
2197 CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
2199 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2202 // if (theFaceEntry.empty()) {
2204 // aName += theFace->GetEntry();
2205 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2206 // if (!theSFace->_is_nil())
2207 // theFaceEntry = theSFace->GetID();
2209 if ( !theFaceEntry.in() || !theFaceEntry.in()[0] ||
2210 !theAttrEntry.in() || !theAttrEntry.in()[0] )
2211 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2213 GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
2214 SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
2215 << theFace << ", " << theAttractor << " )";
2218 void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry,
2219 const char* attractorEntry)
2221 GetImpl()->ClearEntry( faceEntry, attractorEntry );
2222 SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '"
2223 << faceEntry << "', '" << attractorEntry << "' )";
2228 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
2231 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
2234 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap ) throw (SALOME::SALOME_Exception)
2237 char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception)
2240 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
2243 this->GetImpl()->UnsetCustomSizeMap(entry);
2244 SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
2248 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
2253 // ///////////////////////
2254 // // ENFORCED VERTICES //
2255 // ///////////////////////
2259 * Returns the list of enforced vertices for a given Face entry
2260 * @return A map of Face entry / List of enforced vertices
2263 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
2266 BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
2268 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
2269 this->GetImpl()->_GetAllEnforcedVerticesByFace();
2270 resultMap->length(faceEntryEnfVertexListMap.size());
2272 ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
2273 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
2274 for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
2275 BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
2276 new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
2277 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2279 _enfVertexList = it_entry->second;
2280 BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
2281 enfVertexList->length(_enfVertexList.size());
2283 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
2284 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2285 for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
2286 currentEnfVertex = (*it_enfVertex);
2288 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2291 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2294 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2297 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2298 coords->length(currentEnfVertex->coords.size());
2299 for (CORBA::ULong i=0;i<coords->length();i++)
2300 coords[i] = currentEnfVertex->coords[i];
2301 enfVertex->coords = coords;
2304 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2307 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2308 faceEntryList->length(currentEnfVertex->faceEntries.size());
2309 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2310 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2311 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2312 enfVertex->faceEntries = faceEntryList;
2315 msg << "Enforced vertex: \n"
2316 << "Name: " << enfVertex->name << "\n";
2317 if (coords->length())
2318 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2319 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2320 << "Group Name: " << enfVertex->grpName;
2322 enfVertexList[j] = enfVertex;
2324 mapElement->enfVertexList = enfVertexList;
2326 resultMap[i] = mapElement;
2329 return resultMap._retn();
2333 * Returns the list of all enforced vertices
2334 * @return a list of enforced vertices
2337 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
2339 BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
2340 const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
2341 resultMap->length(enfVertexList.size());
2343 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
2344 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2345 for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
2346 currentEnfVertex = (*evlIt);
2347 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2349 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2351 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2353 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2354 coords->length(currentEnfVertex->coords.size());
2355 for (CORBA::ULong ind = 0; ind < coords->length(); ind++)
2356 coords[ind] = currentEnfVertex->coords[ind];
2357 enfVertex->coords = coords;
2359 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2361 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2362 faceEntryList->length(currentEnfVertex->faceEntries.size());
2363 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2364 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2365 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2366 enfVertex->faceEntries = faceEntryList;
2369 msg << "Enforced vertex: \n"
2370 << "Name: " << enfVertex->name << "\n";
2371 if (coords->length())
2372 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2373 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2374 << "Group Name: " << enfVertex->grpName;
2376 resultMap[i] = enfVertex;
2378 return resultMap._retn();
2383 * Returns the list of enforced vertices coords for a given Face entry.
2384 * They are the coords of the "manual" enforced vertices.
2385 * @return A map of Face entry / List of enforced vertices coords
2388 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
2391 BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
2393 const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
2394 resultMap->length(entryCoordsListMap.size());
2396 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
2397 ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
2398 for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
2399 BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
2400 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2402 _coordsList = it_entry->second;
2403 BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
2404 coordsList->length(_coordsList.size());
2406 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
2407 for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
2408 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2409 coords->length((*it_coords).size());
2410 for (CORBA::ULong i=0;i<coords->length();i++)
2411 coords[i] = (*it_coords)[i];
2412 coordsList[j] = coords;
2414 mapElement->coordsList = coordsList;
2416 resultMap[i] = mapElement;
2419 return resultMap._retn();
2423 * Returns a map of enforced vertices coords / enforced vertex.
2424 * They are the coords of the "manual" enforced vertices.
2426 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
2429 BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
2430 const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
2431 this->GetImpl()->_GetAllEnforcedVerticesByCoords();
2432 resultMap->length(coordsEnfVertexMap.size());
2434 ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
2435 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2436 for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
2437 currentEnfVertex = (it_coords->second);
2438 BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
2439 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2440 coords->length(it_coords->first.size());
2441 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2442 coords[ind] = it_coords->first[ind];
2443 mapElement->coords = coords;
2445 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2447 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2449 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2451 BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
2452 coords2->length(currentEnfVertex->coords.size());
2453 for (CORBA::ULong ind=0;ind<coords2->length();ind++)
2454 coords2[ind] = currentEnfVertex->coords[ind];
2455 enfVertex->coords = coords2;
2457 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2459 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2460 faceEntryList->length(currentEnfVertex->faceEntries.size());
2461 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2462 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2463 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2464 enfVertex->faceEntries = faceEntryList;
2466 mapElement->enfVertex = enfVertex;
2468 msg << "Enforced vertex: \n"
2469 << "Name: " << enfVertex->name << "\n";
2470 if (coords->length())
2471 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2472 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2473 << "Group Name: " << enfVertex->grpName;
2475 resultMap[i] = mapElement;
2477 return resultMap._retn();
2481 * Returns the list of enforced vertices entries for a given Face entry.
2482 * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
2483 * @return A map of Face entry / List of enforced vertices geom entries
2486 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
2489 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
2491 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
2492 this->GetImpl()->_GetAllEnfVertexEntriesByFace();
2493 resultMap->length(entryEnfVertexEntryListMap.size());
2495 ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
2496 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
2497 entryEnfVertexEntryListMap.begin();
2498 for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
2499 BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
2500 new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
2501 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2503 _enfVertexEntryList = it_entry->second;
2504 BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
2505 enfVertexEntryList->length(_enfVertexEntryList.size());
2507 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
2508 for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
2509 enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
2511 mapElement->enfVertexEntryList = enfVertexEntryList;
2513 resultMap[i] = mapElement;
2516 return resultMap._retn();
2520 * Returns a map of enforced vertices geom entry / enforced vertex.
2521 * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
2523 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
2526 BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
2527 const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
2528 this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
2529 resultMap->length(enfVertexEntryEnfVertexMap.size());
2531 ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
2532 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2533 for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
2534 currentEnfVertex = it_enfVertexEntry->second;
2535 BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
2536 mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
2538 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2540 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2542 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2544 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2545 coords->length(currentEnfVertex->coords.size());
2546 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2547 coords[ind] = currentEnfVertex->coords[ind];
2548 enfVertex->coords = coords;
2550 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2552 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2553 faceEntryList->length(currentEnfVertex->faceEntries.size());
2554 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2555 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2556 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2557 enfVertex->faceEntries = faceEntryList;
2560 msg << "Enforced vertex: \n"
2561 << "Name: " << enfVertex->name << "\n";
2562 if (coords->length())
2563 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2564 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2565 << "Group Name: " << enfVertex->grpName;
2567 mapElement->enfVertex = enfVertex;
2568 resultMap[i] = mapElement;
2570 return resultMap._retn();
2574 * Erase all enforced vertices
2576 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
2578 this->GetImpl()->ClearAllEnforcedVertices();
2579 SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
2583 * Set/get/unset an enforced vertex on face - OBSOLETE
2585 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2586 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2589 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2590 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2593 string theFaceEntry = theFace->GetStudyEntry();
2595 if (theFaceEntry.empty()) {
2596 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2598 if (theFace->GetShapeType() == GEOM::FACE)
2600 if (theFace->GetShapeType() == GEOM::COMPOUND)
2601 aName = "Compound_";
2602 aName += theFace->GetEntry();
2603 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2604 if (!theSFace->_is_nil())
2605 theFaceEntry = theSFace->GetID();
2607 if (theFaceEntry.empty())
2608 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2610 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2611 } catch (SALOME_Exception& ex) {
2612 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2617 * Set/get/unset an enforced vertex with name on face
2619 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2620 CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
2623 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2624 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2627 string theFaceEntry = theFace->GetStudyEntry();
2629 if (theFaceEntry.empty()) {
2630 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2632 if (theFace->GetShapeType() == GEOM::FACE)
2634 if (theFace->GetShapeType() == GEOM::COMPOUND)
2635 aName = "Compound_";
2636 aName += theFace->GetEntry();
2637 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2638 if (!theSFace->_is_nil())
2639 theFaceEntry = theSFace->GetID();
2641 if (theFaceEntry.empty())
2642 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2645 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
2646 } catch (SALOME_Exception& ex) {
2647 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2652 * Set/get/unset an enforced vertex with geom object on face
2654 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2655 throw (SALOME::SALOME_Exception) {
2658 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2659 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2662 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2663 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2666 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2667 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
2668 // if (CORBA::is_nil(measureOp))
2671 // CORBA::Double x, y, z;
2673 // measureOp->PointCoordinates(theVertex, x, y, z);
2675 string theFaceEntry = theFace->GetStudyEntry();
2676 string theVertexEntry = theVertex->GetStudyEntry();
2678 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2681 if (theFaceEntry.empty()) {
2682 if (theFace->GetShapeType() == GEOM::FACE)
2684 if (theFace->GetShapeType() == GEOM::COMPOUND)
2685 aName = "Compound_";
2686 aName += theFace->GetEntry();
2687 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2688 if (!theSFace->_is_nil())
2689 theFaceEntry = theSFace->GetID();
2691 if (theFaceEntry.empty())
2692 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2694 if (theVertexEntry.empty()) {
2695 if (theVertex->GetShapeType() == GEOM::VERTEX)
2697 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2698 aName = "Compound_";
2699 aName += theVertex->GetEntry();
2700 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
2701 if (!theSVertex->_is_nil())
2702 theVertexEntry = theSVertex->GetID();
2704 if (theVertexEntry.empty())
2705 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2707 string theVertexName = theVertex->GetName();
2709 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
2710 } catch (SALOME_Exception& ex) {
2711 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2716 * Set an enforced vertex with group name on face
2718 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
2719 throw (SALOME::SALOME_Exception)
2723 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2724 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2727 string theFaceEntry = theFace->GetStudyEntry();
2729 if (theFaceEntry.empty()) {
2730 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2732 if (theFace->GetShapeType() == GEOM::FACE)
2734 if (theFace->GetShapeType() == GEOM::COMPOUND)
2735 aName = "Compound_";
2736 aName += theFace->GetEntry();
2737 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2738 if (!theSFace->_is_nil())
2739 theFaceEntry = theSFace->GetID();
2741 if (theFaceEntry.empty())
2742 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2744 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
2745 } catch (SALOME_Exception& ex) {
2746 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2751 * Set an enforced vertex with name and group name on face
2753 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z,
2754 const char* theVertexName, const char* theGroupName)
2755 throw (SALOME::SALOME_Exception)
2759 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2760 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2763 string theFaceEntry = theFace->GetStudyEntry();
2765 if (theFaceEntry.empty()) {
2766 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2768 if (theFace->GetShapeType() == GEOM::FACE)
2770 if (theFace->GetShapeType() == GEOM::COMPOUND)
2771 aName = "Compound_";
2772 aName += theFace->GetEntry();
2773 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2774 if (!theSFace->_is_nil())
2775 theFaceEntry = theSFace->GetID();
2777 if (theFaceEntry.empty())
2778 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2780 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
2781 } catch (SALOME_Exception& ex) {
2782 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2787 * Set an enforced vertex with geom entry and group name on face
2789 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
2790 throw (SALOME::SALOME_Exception)
2794 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2795 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2798 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2799 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2802 string theFaceEntry = theFace->GetStudyEntry();
2803 string theVertexEntry = theVertex->GetStudyEntry();
2805 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2808 if (theFaceEntry.empty()) {
2809 if (theFace->GetShapeType() == GEOM::FACE)
2811 if (theFace->GetShapeType() == GEOM::COMPOUND)
2812 aName = "Compound_";
2813 aName += theFace->GetEntry();
2814 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2815 if (!theSFace->_is_nil())
2816 theFaceEntry = theSFace->GetID();
2818 if (theFaceEntry.empty())
2819 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2821 if (theVertexEntry.empty()) {
2822 if (theVertex->GetShapeType() == GEOM::VERTEX)
2824 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2825 aName = "Compound_";
2826 aName += theVertex->GetEntry();
2827 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
2828 if (!theSVertex->_is_nil())
2829 theVertexEntry = theSVertex->GetID();
2831 if (theVertexEntry.empty())
2832 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2834 string theVertexName = theVertex->GetName();
2836 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
2837 } catch (SALOME_Exception& ex) {
2838 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2842 //Enable internal enforced vertices on specific face if requested by user
2844 // * Are internal enforced vertices used for a face ?
2846 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
2847 // throw (SALOME::SALOME_Exception) {
2848 // ASSERT(myBaseImpl);
2850 // if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2851 // THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2854 // string theFaceEntry = theFace->GetStudyEntry();
2856 // if (theFaceEntry.empty()) {
2857 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2859 // if (theFace->GetShapeType() == GEOM::FACE)
2861 // if (theFace->GetShapeType() == GEOM::COMPOUND)
2862 // aName = "Compound_";
2863 // aName += theFace->GetEntry();
2864 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2865 // if (!theSFace->_is_nil())
2866 // theFaceEntry = theSFace->GetID();
2868 // if (theFaceEntry.empty())
2869 // THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2872 // return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
2873 // } catch (SALOME_Exception& ex) {
2874 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2879 * Get the list of all enforced vertices
2881 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
2882 throw (SALOME::SALOME_Exception) {
2885 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2886 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2889 string theFaceEntry = theFace->GetStudyEntry();
2891 if (theFaceEntry.empty()) {
2892 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2894 if (theFace->GetShapeType() == GEOM::FACE)
2896 if (theFace->GetShapeType() == GEOM::COMPOUND)
2897 aName = "Compound_";
2898 aName += theFace->GetEntry();
2899 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2900 if (!theSFace->_is_nil())
2901 theFaceEntry = theSFace->GetID();
2903 if (theFaceEntry.empty())
2904 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2907 return GetEnforcedVerticesEntry(theFaceEntry.c_str());
2908 } catch (SALOME_Exception& ex) {
2909 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2913 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2914 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2917 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2918 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2921 string theFaceEntry = theFace->GetStudyEntry();
2923 if (theFaceEntry.empty()) {
2924 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2926 if (theFace->GetShapeType() == GEOM::FACE)
2928 if (theFace->GetShapeType() == GEOM::COMPOUND)
2929 aName = "Compound_";
2930 aName += theFace->GetEntry();
2931 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2932 if (!theSFace->_is_nil())
2933 theFaceEntry = theSFace->GetID();
2935 if (theFaceEntry.empty())
2936 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2939 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2940 } catch (SALOME_Exception& ex) {
2941 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2945 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2946 throw (SALOME::SALOME_Exception) {
2949 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2950 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2952 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2953 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2956 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2957 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
2958 // if (CORBA::is_nil(measureOp))
2961 // CORBA::Double x, y, z;
2963 // measureOp->PointCoordinates(theVertex, x, y, z);
2965 std::string theFaceEntry = theFace->GetStudyEntry();
2966 std::string theVertexEntry = theVertex->GetStudyEntry();
2968 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2971 if (theFaceEntry.empty()) {
2972 if (theFace->GetShapeType() == GEOM::FACE)
2974 if (theFace->GetShapeType() == GEOM::COMPOUND)
2975 aName = "Compound_";
2976 aName += theFace->GetEntry();
2977 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2978 if (!theSFace->_is_nil())
2979 theFaceEntry = theSFace->GetID();
2981 if (theFaceEntry.empty())
2982 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2984 if (theVertexEntry.empty()) {
2985 if (theVertex->GetShapeType() == GEOM::VERTEX)
2987 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2988 aName = "Compound_";
2989 aName += theVertex->GetEntry();
2990 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
2991 if (!theSVertex->_is_nil())
2992 theVertexEntry = theSVertex->GetID();
2994 if (theVertexEntry.empty())
2995 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2999 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
3000 } catch (SALOME_Exception& ex) {
3001 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3005 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception) {
3008 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
3009 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
3012 string theFaceEntry = theFace->GetStudyEntry();
3014 if (theFaceEntry.empty()) {
3015 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3017 if (theFace->GetShapeType() == GEOM::FACE)
3019 if (theFace->GetShapeType() == GEOM::COMPOUND)
3020 aName = "Compound_";
3021 aName += theFace->GetEntry();
3022 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
3023 if (!theSFace->_is_nil())
3024 theFaceEntry = theSFace->GetID();
3026 if (theFaceEntry.empty())
3027 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3031 return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
3032 } catch (SALOME_Exception& ex) {
3033 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3038 * Set/get/unset an enforced vertex on face - NEW (no face)
3040 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
3045 return SetEnforcedVertexEntry("", x, y, z);
3046 } catch (SALOME_Exception& ex) {
3047 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3052 * Set/get/unset an enforced vertex with name on face
3054 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception)
3057 return SetEnforcedVertexEntry("", x, y, z, theVertexName);
3058 } catch (SALOME_Exception& ex) {
3059 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3064 * Set/get/unset an enforced vertex with geom object on face
3066 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
3067 throw (SALOME::SALOME_Exception)
3069 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3070 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3072 string theVertexEntry = theVertex->GetStudyEntry();
3074 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3077 if (theVertexEntry.empty()) {
3078 if (theVertex->GetShapeType() == GEOM::VERTEX)
3080 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3081 aName = "Compound_";
3082 aName += theVertex->GetEntry();
3083 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
3084 if (!theSVertex->_is_nil())
3085 theVertexEntry = theSVertex->GetID();
3087 if (theVertexEntry.empty())
3088 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3090 string theVertexName = theVertex->GetName();
3092 return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
3093 } catch (SALOME_Exception& ex) {
3094 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3099 * Set an enforced vertex with group name on face
3101 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
3102 throw (SALOME::SALOME_Exception)
3107 return SetEnforcedVertexEntry("", x, y, z, "", "", theGroupName);
3108 } catch (SALOME_Exception& ex) {
3109 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3114 * Set an enforced vertex with name and group name on face
3116 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z,
3117 const char* theVertexName, const char* theGroupName)
3118 throw (SALOME::SALOME_Exception)
3123 return SetEnforcedVertexEntry("", x, y, z, theVertexName, "", theGroupName);
3124 } catch (SALOME_Exception& ex) {
3125 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3130 * Set an enforced vertex with geom entry and group name on face
3132 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
3133 throw (SALOME::SALOME_Exception)
3135 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3136 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3139 string theVertexEntry = theVertex->GetStudyEntry();
3141 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3144 if (theVertexEntry.empty()) {
3145 if (theVertex->GetShapeType() == GEOM::VERTEX)
3147 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3148 aName = "Compound_";
3149 aName += theVertex->GetEntry();
3150 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
3151 if (!theSVertex->_is_nil())
3152 theVertexEntry = theSVertex->GetID();
3154 if (theVertexEntry.empty())
3155 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3157 string theVertexName = theVertex->GetName();
3159 return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
3160 } catch (SALOME_Exception& ex) {
3161 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3165 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
3168 return UnsetEnforcedVertexEntry("", x, y, z);
3169 } catch (SALOME_Exception& ex) {
3170 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3174 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
3175 throw (SALOME::SALOME_Exception)
3177 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3178 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3180 std::string theVertexEntry = theVertex->GetStudyEntry();
3182 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3185 if (theVertexEntry.empty()) {
3186 if (theVertex->GetShapeType() == GEOM::VERTEX)
3188 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3189 aName = "Compound_";
3190 aName += theVertex->GetEntry();
3191 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
3192 if (!theSVertex->_is_nil())
3193 theVertexEntry = theSVertex->GetID();
3195 if (theVertexEntry.empty())
3196 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3199 return UnsetEnforcedVertexEntry("", 0, 0, 0, theVertexEntry.c_str());
3200 } catch (SALOME_Exception& ex) {
3201 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3205 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertices() throw (SALOME::SALOME_Exception)
3208 return UnsetEnforcedVerticesEntry("");
3209 } catch (SALOME_Exception& ex) {
3210 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3215 * Set/get/unset an enforced vertex on geom object given by entry
3217 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry,
3221 const char* theVertexName,
3222 const char* theVertexEntry,
3223 const char* theGroupName)
3224 throw (SALOME::SALOME_Exception)
3226 bool newValue = false;
3227 if (string(theVertexEntry).empty()) {
3229 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
3230 this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
3231 ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
3232 coords.push_back(x);
3233 coords.push_back(y);
3234 coords.push_back(z);
3235 if (coordsList.find(coords) == coordsList.end()) {
3238 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
3239 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3243 } catch (const std::invalid_argument& ex) {
3244 // no enforced vertex for entry
3248 if (string(theVertexName).empty()) {
3249 if (string(theGroupName).empty())
3250 SMESH::TPythonDump() << _this() << ".AddEnforcedVertex(" << x << ", " << y << ", " << z << ")";
3252 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
3255 if (string(theGroupName).empty())
3256 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
3258 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", \""
3259 << theVertexName << "\", \"" << theGroupName << "\")";
3264 ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
3265 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
3266 if ( it == enfVertexEntryList.end()) {
3270 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
3271 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3275 } catch (const std::invalid_argument& ex) {
3276 // no enforced vertex for entry
3280 if (string(theGroupName).empty())
3281 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeom(" << theVertexEntry << ")";
3283 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeomWithGroup(" << theVertexEntry << ", \"" << theGroupName << "\")";
3288 this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
3293 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
3294 throw (SALOME::SALOME_Exception)
3297 BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
3298 ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
3299 vertexList->length(_vList.size());
3300 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
3301 for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
3302 ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
3304 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
3307 enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
3308 // Geom Vertex Entry
3309 enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
3311 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
3312 coords->length(_enfVertex->coords.size());
3313 for ( CORBA::ULong ind = 0; ind < coords->length(); ind++ )
3314 coords[ind] = _enfVertex->coords[ind];
3315 enfVertex->coords = coords;
3317 enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
3319 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
3320 faceEntryList->length(_enfVertex->faceEntries.size());
3321 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
3322 for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
3323 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
3324 enfVertex->faceEntries = faceEntryList;
3326 vertexList[i] = enfVertex;
3328 return vertexList._retn();
3329 } catch (const std::invalid_argument& ex) {
3330 SALOME::ExceptionStruct ExDescription;
3331 ExDescription.text = ex.what();
3332 ExDescription.type = SALOME::BAD_PARAM;
3333 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
3334 ExDescription.lineNumber = 1385;
3335 throw SALOME::SALOME_Exception(ExDescription);
3336 } catch (const std::exception& ex) {
3337 std::cout << "Exception: " << ex.what() << std::endl;
3338 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3342 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception)
3348 res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
3350 if (string(theVertexEntry).empty())
3351 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertex(" << x << ", " << y << ", " << z
3354 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom(" << theVertexEntry << ")";
3356 } catch (const std::invalid_argument& ex) {
3358 } catch (const std::exception& ex) {
3359 std::cout << "Exception: " << ex.what() << std::endl;
3360 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3365 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception)
3370 this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
3371 SMESH::TPythonDump() << _this() << ".RemoveEnforcedVertices()";
3372 } catch (const std::invalid_argument& ex) {
3374 } catch (const std::exception& ex) {
3375 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3381 //=============================================================================
3383 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
3387 //=============================================================================
3388 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue)
3391 this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
3392 std::string theValueStr = theValue ? "True" : "False";
3393 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
3396 //=============================================================================
3398 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
3402 //=============================================================================
3403 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces()
3406 return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
3409 //=============================================================================
3411 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
3415 //=============================================================================
3416 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName)
3419 this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
3420 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
3423 //=============================================================================
3425 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
3429 //=============================================================================
3430 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup()
3433 return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
3437 * Enable internal enforced vertices on specific face if requested by user
3439 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
3440 throw (SALOME::SALOME_Exception)
3443 SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
3444 } catch (SALOME_Exception& ex) {
3445 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3449 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3450 throw (SALOME::SALOME_Exception)
3453 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
3454 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
3457 string theFaceEntry = theFace->GetStudyEntry();
3459 if (theFaceEntry.empty()) {
3460 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3461 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3463 if (theFace->GetShapeType() == GEOM::FACE)
3465 if (theFace->GetShapeType() == GEOM::COMPOUND)
3466 aName = "Compound_";
3467 aName += theFace->GetEntry();
3468 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
3469 if (!theSFace->_is_nil())
3470 theFaceEntry = theSFace->GetID();
3472 if (theFaceEntry.empty())
3473 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3476 SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
3477 } catch (SALOME_Exception& ex) {
3478 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3482 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3483 throw (SALOME::SALOME_Exception)
3487 this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
3488 std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
3489 if (string(theGroupName).empty())
3490 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
3492 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
3493 } catch (const std::exception& ex) {
3494 std::cout << "Exception: " << ex.what() << std::endl;
3495 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3502 char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
3503 throw (SALOME::SALOME_Exception)
3507 return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
3509 catch (const std::invalid_argument& ex) {
3510 SALOME::ExceptionStruct ExDescription;
3511 ExDescription.text = ex.what();
3512 ExDescription.type = SALOME::BAD_PARAM;
3513 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
3514 ExDescription.lineNumber = 1146;
3515 throw SALOME::SALOME_Exception(ExDescription);
3517 catch (SALOME_Exception& ex) {
3518 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3524 void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
3525 throw (SALOME::SALOME_Exception)
3529 this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
3531 catch (const std::invalid_argument& ex) {
3532 SALOME::ExceptionStruct ExDescription;
3533 ExDescription.text = ex.what();
3534 ExDescription.type = SALOME::BAD_PARAM;
3535 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
3536 ExDescription.lineNumber = 1170;
3537 throw SALOME::SALOME_Exception(ExDescription);
3539 catch (SALOME_Exception& ex) {
3540 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3543 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
3544 << x << ", " << y << ", " << z << ", '" << groupName << "' )";
3548 ///////////////////////
3550 ///////////////////////
3552 ///////////////////////
3555 std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
3557 std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
3558 MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
3559 MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
3560 MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID");
3561 MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL");
3562 MapShapeTypeToString[GEOM::FACE] = std::string("FACE");
3563 MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE");
3564 MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE");
3565 MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX");
3566 MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE");
3567 std::string txtShapeType = MapShapeTypeToString[theShapeType];
3568 return txtShapeType;
3571 void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes)
3573 // Check shape types
3575 std::stringstream typesTxt;
3576 for (std::size_t i=0; i<theShapeTypes.size(); i++)
3578 GEOM::shape_type theShapeType = theShapeTypes[i];
3579 if (shape->GetShapeType() == theShapeType)
3581 typesTxt << ShapeTypeToString(theShapeType);
3582 if (i < theShapeTypes.size()-1 )
3586 std::stringstream msg;
3587 msg << "shape type is not in" << typesTxt.str();
3588 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3592 void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType)
3595 if (shape->GetShapeType() != theShapeType) {
3596 std::stringstream msg;
3597 msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
3598 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3602 std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix)
3604 // Check shape is published in the object browser
3605 string shapeEntry = shape->GetStudyEntry();
3607 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3610 // Publish shape if needed
3611 if (shapeEntry.empty()) {
3612 if (shape->GetShapeType() == theShapeType)
3614 aName += shape->GetEntry();
3615 SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(NULL, shape, aName.c_str());
3616 if (!theSFace1->_is_nil())
3617 shapeEntry = theSFace1->GetID();
3619 if (shapeEntry.empty())
3620 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3624 // Format the output of two vectors to use it in MESSAGE and PythonDump
3625 std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
3627 std::stringstream listEntriesTxt;
3629 if (!theSourceVerticesEntries.empty())
3631 listEntriesTxt << ", [" ;
3633 for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
3636 listEntriesTxt << ", ";
3637 listEntriesTxt << *it;
3640 listEntriesTxt << "], [" ;
3642 for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
3645 listEntriesTxt << ", ";
3646 listEntriesTxt << *it;
3648 listEntriesTxt << "]" ;
3650 return listEntriesTxt.str();
3654 * Erase all PreCad periodicity associations
3656 void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
3658 this->GetImpl()->ClearPreCadPeriodicityVectors();
3659 SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
3662 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
3664 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3665 this->GetImpl()->_GetPreCadFacesPeriodicityVector();
3667 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3669 return periodicityList._retn();
3672 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
3674 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3675 this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
3677 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3679 return periodicityList._retn();
3682 // convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
3683 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
3685 BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
3687 periodicityList->length(preCadPeriodicityVector.size());
3689 for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
3691 ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
3693 BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
3694 myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
3695 myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
3697 BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
3698 if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
3700 sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
3701 for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
3702 sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
3705 myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
3707 BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
3708 if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
3710 targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
3711 for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
3712 targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
3715 myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
3717 periodicityList[i] = myPreCadPeriodicity;
3721 return periodicityList._retn();
3725 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
3726 throw (SALOME::SALOME_Exception)
3729 const GEOM::ListOfGO theSourceVertices;
3730 const GEOM::ListOfGO theTargetVertices;
3731 AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices);
3735 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
3736 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3737 throw (SALOME::SALOME_Exception)
3741 size_t theLength = theSourceVertices.length();
3742 if (theLength != theTargetVertices.length())
3743 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3745 std::vector<GEOM::shape_type> allowedShapeTypes;
3746 allowedShapeTypes.push_back(GEOM::FACE);
3747 allowedShapeTypes.push_back(GEOM::COMPOUND);
3749 string prefix1 = "Source_face_";
3750 CheckShapeTypes(theFace1, allowedShapeTypes);
3751 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
3753 string prefix2 = "Target_face_";
3754 CheckShapeTypes(theFace2, allowedShapeTypes);
3755 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
3757 string prefix3 = "Source_vertex_";
3758 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3759 theSourceVerticesEntries->length(theLength);
3760 GEOM::GEOM_Object_ptr theVtx_i;
3762 for (size_t ind = 0; ind < theLength; ind++) {
3763 theVtx_i = theSourceVertices[ind];
3764 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3765 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3768 string prefix4 = "Target_vertex_";
3769 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3770 theTargetVerticesEntries->length(theLength);
3771 for (size_t ind = 0; ind < theLength; ind++) {
3772 theVtx_i = theTargetVertices[ind];
3773 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3774 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3777 string theFace2Name = theFace2->GetName();
3779 AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
3780 theSourceVerticesEntries, theTargetVerticesEntries);
3781 } catch (SALOME_Exception& ex) {
3782 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3787 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
3788 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3789 throw (SALOME::SALOME_Exception)
3794 // Convert BLSURFPlugin::TEntryList to vector<string>
3795 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3796 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3797 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3798 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3801 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3804 this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
3805 theSourceVerticesEntries, theTargetVerticesEntries);
3807 SMESH::TPythonDump pd;
3808 if (!theSourceVerticesEntries.empty())
3810 pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
3811 pd << listEntriesTxt.c_str();
3815 pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
3818 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
3819 throw (SALOME::SALOME_Exception)
3822 const GEOM::ListOfGO theSourceVertices;
3823 const GEOM::ListOfGO theTargetVertices;
3824 AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices);
3827 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
3828 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3829 throw (SALOME::SALOME_Exception)
3833 size_t theLength = theSourceVertices.length();
3834 if (theLength != theTargetVertices.length())
3835 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3837 std::vector<GEOM::shape_type> allowedShapeTypes;
3838 allowedShapeTypes.push_back(GEOM::EDGE);
3839 allowedShapeTypes.push_back(GEOM::COMPOUND);
3841 string prefix1 = "Source_edge_";
3842 CheckShapeTypes(theEdge1, allowedShapeTypes);
3843 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1);
3845 string prefix2 = "Target_edge_";
3846 CheckShapeTypes(theEdge2, allowedShapeTypes);
3847 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
3849 string prefix3 = "Source_vertex_";
3850 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3851 theSourceVerticesEntries->length(theLength);
3852 GEOM::GEOM_Object_ptr theVtx_i;
3854 for (size_t ind = 0; ind < theLength; ind++) {
3855 theVtx_i = theSourceVertices[ind];
3856 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3857 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3860 string prefix4 = "Target_vertex_";
3861 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3862 theTargetVerticesEntries->length(theLength);
3863 for (size_t ind = 0; ind < theLength; ind++) {
3864 theVtx_i = theTargetVertices[ind];
3865 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3866 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3869 string theEdge2Name = theEdge2->GetName();
3871 AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
3872 theSourceVerticesEntries, theTargetVerticesEntries);
3873 } catch (SALOME_Exception& ex) {
3874 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3879 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
3880 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3881 throw (SALOME::SALOME_Exception)
3886 // Convert BLSURFPlugin::TEntryList to vector<string>
3887 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3888 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3889 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3890 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3893 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3895 this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
3896 theSourceVerticesEntries, theTargetVerticesEntries);
3898 SMESH::TPythonDump pd;
3899 if (!theSourceVerticesEntries.empty())
3901 pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
3902 pd << listEntriesTxt.c_str();
3906 pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
3911 //================================================================================
3913 * \brief Sets the file for export resulting mesh in GMF format
3914 * \param theFileName - full name of the file (.mesh, .meshb)
3916 * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
3918 //================================================================================
3919 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
3920 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
3922 bool valueChanged/*, modeChanged*/ = false;
3924 valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
3925 // modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
3926 if (valueChanged)// or (!valueChanged && modeChanged))
3927 this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
3928 } catch (const std::exception& ex) {
3929 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3931 if (valueChanged)// or (!valueChanged && modeChanged))
3932 SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
3935 //================================================================================
3937 * \brief Gets the file name for export resulting mesh in GMF format
3938 * \retval char* - The file name
3940 * Returns the GMF file name
3942 //================================================================================
3943 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
3945 return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
3948 // //================================================================================
3950 // * \brief Gets the file mode for export resulting mesh in GMF format
3951 // * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
3953 // * Returns the GMF file mode
3955 // //================================================================================
3956 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
3957 // ASSERT(myBaseImpl);
3958 // return this->GetImpl()->GetGMFFileMode();
3961 //=============================================================================
3963 * BLSURFPlugin_Hypothesis_i::GetImpl
3965 * Get implementation
3967 //=============================================================================
3968 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
3969 return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
3972 //================================================================================
3974 * \brief Verify whether hypothesis supports given entity type
3975 * \param type - dimension (see SMESH::Dimension enumeration)
3976 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
3978 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
3980 //================================================================================
3981 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
3982 return type == SMESH::DIM_2D;
3986 //================================================================================
3988 * \brief Return geometry this hypothesis depends on. Return false if there is no geometry parameter
3990 //================================================================================
3993 BLSURFPlugin_Hypothesis_i::getObjectsDependOn( std::vector< std::string > & entryArray,
3994 std::vector< int > & subIDArray ) const
3996 typedef ::BLSURFPlugin_Hypothesis BH;
3997 const BH* impl = static_cast<const BH*>( myBaseImpl );
4000 const BH::TSizeMap& sizeMap = impl->_GetSizeMapEntries();
4001 BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
4002 for ( ; entry2size != sizeMap.cend(); ++entry2size )
4003 entryArray.push_back( entry2size->first );
4006 const BH::TSizeMap& sizeMap = impl->_GetAttractorEntries();
4007 BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
4008 for ( ; entry2size != sizeMap.cend(); ++entry2size )
4009 entryArray.push_back( entry2size->first );
4012 const BH::TAttractorMap& classAttractors = impl-> _GetClassAttractorEntries();
4013 BH::TAttractorMap::const_iterator entry2size = classAttractors.cbegin();
4014 for ( ; entry2size != classAttractors.cend(); ++entry2size )
4015 entryArray.push_back( entry2size->first );
4018 const BH::TFaceEntryEnfVertexListMap& faceEntryEnfVertexListMap = impl->_GetAllEnforcedVerticesByFace();
4019 BH::TFaceEntryEnfVertexListMap::const_iterator entry2evList = faceEntryEnfVertexListMap.cbegin();
4020 for ( ; entry2evList != faceEntryEnfVertexListMap.cend(); ++entry2evList )
4022 entryArray.push_back( entry2evList->first );
4024 const BH::TEnfVertexList& evList = entry2evList->second;
4025 BH::TEnfVertexList::const_iterator evIt = evList.cbegin();
4026 for ( ; evIt != evList.cend(); ++evIt )
4028 const BH::TEnfVertex* ev = *evIt;
4029 entryArray.push_back( ev->geomEntry );
4030 entryArray.insert( entryArray.end(), ev->faceEntries.cbegin(), ev->faceEntries.cend() );
4034 // { // duplicated data of faceEntryEnfVertexListMap
4035 // const BH::TEnfVertexList& enfVertexList = impl->_GetAllEnforcedVertices();
4036 // const BH::TFaceEntryCoordsListMap& faceEntryCoordsListMap = impl->_GetAllCoordsByFace();
4037 // const BH::TFaceEntryEnfVertexEntryListMap& faceEntryEnfVertexEntryListMap = impl->_GetAllEnfV // const BH::TEnfVertexEntryEnfVertexMap& enfVertexEntryEnfVertexMap = impl->_GetAllEnforcedVert // }
4039 const BH::TPreCadPeriodicityVector& preCadFacesPeriodicityVector = impl->_GetPreCadFacesPeriodicityVector();
4040 BH::TPreCadPeriodicityVector::const_iterator pcp = preCadFacesPeriodicityVector.cbegin();
4041 for ( ; pcp != preCadFacesPeriodicityVector.cend(); ++pcp )
4043 entryArray.push_back( pcp->shape1Entry );
4044 entryArray.push_back( pcp->shape2Entry );
4045 entryArray.insert( entryArray.end(),
4046 pcp->theSourceVerticesEntries.cbegin(),
4047 pcp->theSourceVerticesEntries.cend() );
4048 entryArray.insert( entryArray.end(),
4049 pcp->theTargetVerticesEntries.cbegin(),
4050 pcp->theTargetVerticesEntries.cend() );
4054 const BH::TPreCadPeriodicityVector& preCadEdgesPeriodicityVector = impl->_GetPreCadEdgesPeriodicityVector();
4055 BH::TPreCadPeriodicityVector::const_iterator pcp = preCadEdgesPeriodicityVector.cbegin();
4056 for ( ; pcp != preCadEdgesPeriodicityVector.cend(); ++pcp )
4058 entryArray.push_back( pcp->shape1Entry );
4059 entryArray.push_back( pcp->shape2Entry );
4060 entryArray.insert( entryArray.end(),
4061 pcp->theSourceVerticesEntries.cbegin(),
4062 pcp->theSourceVerticesEntries.cend() );
4063 entryArray.insert( entryArray.end(),
4064 pcp->theTargetVerticesEntries.cbegin(),
4065 pcp->theTargetVerticesEntries.cend() );
4069 const BH::THyperPatchList& hyperPatchList = impl->GetHyperPatches();
4070 BH::THyperPatchList::const_iterator idSet = hyperPatchList.cbegin();
4071 for ( ; idSet != hyperPatchList.cend(); ++idSet )
4073 subIDArray.insert( subIDArray.end(), idSet->cbegin(), idSet->cend() );
4079 //================================================================================
4081 * \brief Set new geometry instead of that returned by getObjectsDependOn()
4083 //================================================================================
4086 BLSURFPlugin_Hypothesis_i::setObjectsDependOn( std::vector< std::string > & entryArray,
4087 std::vector< int > & subIDArray )
4089 typedef ::BLSURFPlugin_Hypothesis BH;
4090 BH* impl = static_cast<BH*>( myBaseImpl );
4094 BH::TSizeMap& sizeMapNew = const_cast< BH::TSizeMap& >( impl->_GetSizeMapEntries() );
4095 BH::TSizeMap sizeMap;
4096 sizeMap.swap( sizeMapNew );
4097 BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
4098 for ( ; entry2size != sizeMap.cend(); ++entry2size, ++iEnt )
4099 if ( entryArray[ iEnt ].empty() == entry2size->first.empty() )
4100 sizeMapNew[ entryArray[ iEnt ]] = entry2size->second;
4103 BH::TSizeMap& sizeMapNew = const_cast< BH::TSizeMap& >( impl->_GetAttractorEntries() );
4104 BH::TSizeMap sizeMap;
4105 sizeMap.swap( sizeMapNew );
4106 BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
4107 for ( ; entry2size != sizeMap.cend(); ++entry2size, ++iEnt )
4108 if ( entryArray[ iEnt ].empty() == entry2size->first.empty() )
4109 sizeMapNew[ entryArray[ iEnt ]] = entry2size->second;
4112 BH::TAttractorMap& attrMapNew =
4113 const_cast< BH::TAttractorMap& > ( impl->_GetClassAttractorEntries() );
4114 BH::TAttractorMap attrMap;
4115 attrMap.swap( attrMapNew );
4116 BH::TAttractorMap::const_iterator entry2size = attrMap.cbegin();
4117 for ( ; entry2size != attrMap.cend(); ++entry2size, ++iEnt )
4118 if ( entryArray[ iEnt ].empty() == entry2size->first.empty() )
4119 attrMapNew.insert( std::make_pair( entryArray[ iEnt ], entry2size->second ));
4121 delete entry2size->second;
4124 BH::TFaceEntryEnfVertexListMap& faceEntryEnfVertexListMapNew =
4125 const_cast< BH::TFaceEntryEnfVertexListMap& >( impl->_GetAllEnforcedVerticesByFace() );
4126 BH::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap;
4127 faceEntryEnfVertexListMap.swap( faceEntryEnfVertexListMapNew );
4129 BH::TEnfVertexList& enfVertexList =
4130 const_cast< BH::TEnfVertexList& > ( impl->_GetAllEnforcedVertices() );
4131 enfVertexList.clear(); // avoid removal
4133 impl->ClearAllEnforcedVertices();
4135 BH::TFaceEntryEnfVertexListMap::iterator entry2evList = faceEntryEnfVertexListMap.begin();
4136 for ( ; entry2evList != faceEntryEnfVertexListMap.end(); ++entry2evList )
4138 const BH::TEntry& entry = entryArray[ iEnt++ ];
4139 bool faceOk = ( entry.empty() == entry2evList->first.empty() );
4141 BH::TEnfVertexList& evList = entry2evList->second;
4142 BH::TEnfVertexList::iterator evIt = evList.begin();
4143 for ( ; evIt != evList.end(); ++evIt )
4145 BH::TEnfVertex* ev = *evIt;
4146 bool ok = faceOk && ( ev->geomEntry.empty() != entryArray[ iEnt ].empty() );
4147 ev->geomEntry = entryArray[ iEnt++ ];
4148 BH::TEntryList faceEntriesNew;
4149 BH::TEntryList::iterator fEnt = ev->faceEntries.begin();
4150 for ( ; fEnt != ev->faceEntries.end(); ++fEnt, ++iEnt )
4152 if ( !entryArray[ iEnt ].empty() )
4153 faceEntriesNew.insert( entryArray[ iEnt ]);
4157 ev->faceEntries.swap( faceEntriesNew );
4158 impl->AddEnforcedVertex( entry, ev );
4168 BH::TPreCadPeriodicityVector& preCadPeriodicityVector =
4169 const_cast< BH::TPreCadPeriodicityVector&> ( impl->_GetPreCadFacesPeriodicityVector() );
4170 BH::TPreCadPeriodicityVector::iterator pcp = preCadPeriodicityVector.begin();
4171 for ( ; pcp != preCadPeriodicityVector.end(); ++pcp )
4173 pcp->shape1Entry = entryArray[ iEnt++ ];
4174 pcp->shape2Entry = entryArray[ iEnt++ ];
4175 for ( size_t i = 0; i < pcp->theSourceVerticesEntries.size(); ++i, iEnt++ )
4176 pcp->theSourceVerticesEntries[i] = entryArray[ iEnt ];
4178 for ( size_t i = 0; i < pcp->theTargetVerticesEntries.size(); ++i, iEnt++ )
4179 pcp->theTargetVerticesEntries[i] = entryArray[ iEnt ];
4183 BH::TPreCadPeriodicityVector& preCadPeriodicityVector =
4184 const_cast< BH::TPreCadPeriodicityVector&> ( impl->_GetPreCadEdgesPeriodicityVector() );
4185 BH::TPreCadPeriodicityVector::iterator pcp = preCadPeriodicityVector.begin();
4186 for ( ; pcp != preCadPeriodicityVector.end(); ++pcp )
4188 pcp->shape1Entry = entryArray[ iEnt++ ];
4189 pcp->shape2Entry = entryArray[ iEnt++ ];
4190 for ( size_t i = 0; i < pcp->theSourceVerticesEntries.size(); ++i, iEnt++ )
4191 pcp->theSourceVerticesEntries[i] = entryArray[ iEnt ];
4193 for ( size_t i = 0; i < pcp->theTargetVerticesEntries.size(); ++i, iEnt++ )
4194 pcp->theTargetVerticesEntries[i] = entryArray[ iEnt ];
4200 BH::THyperPatchList& hyperPatchListNew =
4201 const_cast< BH::THyperPatchList& >( impl->GetHyperPatches() );
4202 BH::THyperPatchList hyperPatchList;
4203 hyperPatchList.swap( hyperPatchListNew );
4204 BH::THyperPatchList::iterator idSet = hyperPatchList.begin();
4205 for ( ; idSet != hyperPatchList.end(); ++idSet )
4207 BH::THyperPatchTags& ids = *idSet;
4208 BH::THyperPatchTags idsNew;
4209 BH::THyperPatchTags::iterator i = ids.begin();
4210 for ( ; i != ids.end(); ++i, ++iID )
4211 if ( subIDArray[ iID ] > 0 )
4212 idsNew.insert( subIDArray[ iID ]);
4213 if ( !idsNew.empty() )
4214 hyperPatchListNew.push_back( idsNew );
4218 return ( iEnt == entryArray.size() && iID == subIDArray.size() );