1 // Copyright (C) 2007-2020 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 // File : BLSURFPlugin_Hypothesis.cxx
22 // Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA)
23 // Size maps developement: Nicolas GEIMER (OCC) & Gilles DAVID (EURIWARE)
26 #include "BLSURFPlugin_Hypothesis_i.hxx"
28 #include <SMESH_Gen.hxx>
29 #include <SMESH_Gen_i.hxx>
30 #include <SMESH_PythonDump.hxx>
32 #include <SALOMEDS_wrap.hxx>
33 #include <Utils_CorbaException.hxx>
34 #include <utilities.h>
38 #include <boost/regex.hpp>
42 //=============================================================================
44 * BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i
48 //=============================================================================
49 BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA,
50 ::SMESH_Gen* theGenImpl,
52 SALOME::GenericObj_i(thePOA), SMESH_Hypothesis_i(thePOA)
54 myBaseImpl = new ::BLSURFPlugin_Hypothesis(theGenImpl->GetANewId(),
60 //=============================================================================
62 * BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i
66 //=============================================================================
67 BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i()
71 //=============================================================================
73 * BLSURFPlugin_Hypothesis_i::GetMeshGemsVersion
75 * Get version of MeshGems suite.
77 //=============================================================================
78 char* BLSURFPlugin_Hypothesis_i::GetMeshGemsVersion()
80 return CORBA::string_dup( this->GetImpl()->GetMeshGemsVersion().c_str() );
83 //=============================================================================
85 * BLSURFPlugin_Hypothesis_i::SetPhysicalMesh
89 //=============================================================================
90 void BLSURFPlugin_Hypothesis_i::SetPhysicalMesh(CORBA::Long theValue)
93 this->GetImpl()->SetPhysicalMesh((::BLSURFPlugin_Hypothesis::PhysicalMesh) theValue);
94 SMESH::TPythonDump() << _this() << ".SetPhysicalMesh( " << theValue << " )";
97 //=============================================================================
99 * BLSURFPlugin_Hypothesis_i::GetPhysicalMesh
103 //=============================================================================
104 CORBA::Long BLSURFPlugin_Hypothesis_i::GetPhysicalMesh()
107 return this->GetImpl()->GetPhysicalMesh();
110 //=============================================================================
112 * BLSURFPlugin_Hypothesis_i::SetGeometricMesh
117 //=============================================================================
118 void BLSURFPlugin_Hypothesis_i::SetGeometricMesh(CORBA::Long theValue)
121 this->GetImpl()->SetGeometricMesh((::BLSURFPlugin_Hypothesis::GeometricMesh) theValue);
122 SMESH::TPythonDump() << _this() << ".SetGeometricMesh( " << theValue << " )";
125 //=============================================================================
127 * BLSURFPlugin_Hypothesis_i::GetGeometricMesh
131 //=============================================================================
132 CORBA::Long BLSURFPlugin_Hypothesis_i::GetGeometricMesh()
135 return this->GetImpl()->GetGeometricMesh();
138 //=============================================================================
140 * BLSURFPlugin_Hypothesis_i::SetPhySize
144 //=============================================================================
145 void BLSURFPlugin_Hypothesis_i::SetPhySize(CORBA::Double theValue)
148 this->GetImpl()->SetPhySize(theValue, false);
149 SMESH::TPythonDump() << _this() << ".SetPhySize( " << theValue << " )";
152 //=============================================================================
154 * BLSURFPlugin_Hypothesis_i::SetPhySizeRel
156 * Set Relative PhySize
158 //=============================================================================
159 void BLSURFPlugin_Hypothesis_i::SetPhySizeRel(CORBA::Double theValue)
162 this->GetImpl()->SetPhySize(theValue, true);
163 SMESH::TPythonDump() << _this() << ".SetPhySizeRel( " << theValue << " )";
166 //=============================================================================
168 * BLSURFPlugin_Hypothesis_i::GetPhySize
172 //=============================================================================
173 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhySize()
176 return this->GetImpl()->GetPhySize();
179 //=============================================================================
181 * BLSURFPlugin_Hypothesis_i::IsPhySizeRel
183 * Returns True if PhySize is relative
185 //=============================================================================
186 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsPhySizeRel()
189 return this->GetImpl()->IsPhySizeRel();
192 //=============================================================================
193 void BLSURFPlugin_Hypothesis_i::SetMinSize(CORBA::Double theMinSize)
195 if (IsMinSizeRel() || GetMinSize() != theMinSize ) {
196 this->GetImpl()->SetMinSize(theMinSize, false);
197 SMESH::TPythonDump() << _this() << ".SetMinSize( " << theMinSize << " )";
201 //=============================================================================
202 void BLSURFPlugin_Hypothesis_i::SetMinSizeRel(CORBA::Double theMinSize)
204 if ( !IsMinSizeRel() || (GetMinSize() != theMinSize) ) {
205 this->GetImpl()->SetMinSize(theMinSize, true);
206 SMESH::TPythonDump() << _this() << ".SetMinSizeRel( " << theMinSize << " )";
210 //=============================================================================
211 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMinSize()
213 return this->GetImpl()->GetMinSize();
216 //=============================================================================
217 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMinSizeRel()
219 return this->GetImpl()->IsMinSizeRel();
222 //=============================================================================
223 void BLSURFPlugin_Hypothesis_i::SetMaxSize(CORBA::Double theMaxSize)
225 if (IsMaxSizeRel() || GetMaxSize() != theMaxSize) {
226 this->GetImpl()->SetMaxSize(theMaxSize, false);
227 SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theMaxSize << " )";
231 //=============================================================================
232 void BLSURFPlugin_Hypothesis_i::SetMaxSizeRel(CORBA::Double theMaxSize)
234 if ( !IsMaxSizeRel() || (GetMaxSize() != theMaxSize) ) {
235 this->GetImpl()->SetMaxSize(theMaxSize, true);
236 SMESH::TPythonDump() << _this() << ".SetMaxSizeRel( " << theMaxSize << " )";
240 //=============================================================================
241 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMaxSize()
243 return this->GetImpl()->GetMaxSize();
246 //=============================================================================
247 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMaxSizeRel()
249 return this->GetImpl()->IsMaxSizeRel();
253 //=============================================================================
255 * BLSURFPlugin_Hypothesis_i::SetUseGradation
259 //=============================================================================
260 void BLSURFPlugin_Hypothesis_i::SetUseGradation(CORBA::Boolean theValue)
262 if ( GetImpl()->GetUseGradation() != bool( theValue ))
264 this->GetImpl()->SetUseGradation(theValue);
265 std::string theValueStr = theValue ? "True" : "False";
266 SMESH::TPythonDump() << _this() << ".SetUseGradation( " << theValueStr.c_str() << " )";
270 //=============================================================================
272 * BLSURFPlugin_Hypothesis_i::GetUseGradation
276 //=============================================================================
277 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseGradation()
279 return this->GetImpl()->GetUseGradation();
282 //=============================================================================
284 * BLSURFPlugin_Hypothesis_i::SetGradation
288 //=============================================================================
289 void BLSURFPlugin_Hypothesis_i::SetGradation(CORBA::Double theValue)
291 this->GetImpl()->SetGradation(theValue);
294 SetUseGradation( false );
296 SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )";
299 //=============================================================================
301 * BLSURFPlugin_Hypothesis_i::GetGradation
305 //=============================================================================
306 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation()
308 return this->GetImpl()->GetGradation();
311 //=============================================================================
313 * BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation
317 //=============================================================================
318 void BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation(CORBA::Boolean theValue)
320 if ( GetImpl()->GetUseVolumeGradation() != bool( theValue ))
322 this->GetImpl()->SetUseVolumeGradation(theValue);
323 std::string theValueStr = theValue ? "True" : "False";
324 SMESH::TPythonDump() << _this() << ".SetUseVolumeGradation( " << theValueStr.c_str() << " )";
328 //=============================================================================
330 * BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation
334 //=============================================================================
335 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation()
337 return this->GetImpl()->GetUseVolumeGradation();
340 //=============================================================================
342 * BLSURFPlugin_Hypothesis_i::SetVolumeGradation
344 * Set VolumeGradation
346 //=============================================================================
347 void BLSURFPlugin_Hypothesis_i::SetVolumeGradation(CORBA::Double theValue)
349 this->GetImpl()->SetVolumeGradation(theValue);
351 SetUseVolumeGradation( false );
353 SMESH::TPythonDump() << _this() << ".SetVolumeGradation( " << theValue << " )";
356 //=============================================================================
358 * BLSURFPlugin_Hypothesis_i::GetVolumeGradation
360 * Get VolumeGradation
362 //=============================================================================
363 CORBA::Double BLSURFPlugin_Hypothesis_i::GetVolumeGradation()
365 return this->GetImpl()->GetVolumeGradation();
368 //=============================================================================
370 * BLSURFPlugin_Hypothesis_i::SetQuadAllowed
374 * DEPRACATED, kept for python script compatibility
376 * TO be removed in Salome 9
378 //=============================================================================
379 void BLSURFPlugin_Hypothesis_i::SetQuadAllowed(CORBA::Boolean theValue)
381 ::BLSURFPlugin_Hypothesis::ElementType theElementType = theValue ?
382 ::BLSURFPlugin_Hypothesis::QuadrangleDominant : ::BLSURFPlugin_Hypothesis::Triangles;
383 this->GetImpl()->SetElementType(theElementType);
384 SMESH::TPythonDump() << _this() << ".SetElementType( " << theElementType << " )";
387 //=============================================================================
389 * BLSURFPlugin_Hypothesis_i::SetElementType
393 //=============================================================================
394 void BLSURFPlugin_Hypothesis_i::SetElementType(CORBA::Long theValue)
396 this->GetImpl()->SetElementType((::BLSURFPlugin_Hypothesis::ElementType) theValue);
397 SMESH::TPythonDump() << _this() << ".SetElementType( " << theValue << " )";
399 //=============================================================================
401 * BLSURFPlugin_Hypothesis_i::GetElementType
405 //=============================================================================
406 CORBA::Long BLSURFPlugin_Hypothesis_i::GetElementType()
408 return this->GetImpl()->GetElementType();
411 //=============================================================================
413 * BLSURFPlugin_Hypothesis_i::SetAngleMesh
417 //=============================================================================
418 void BLSURFPlugin_Hypothesis_i::SetAngleMesh(CORBA::Double theValue)
420 this->GetImpl()->SetAngleMesh(theValue);
421 SMESH::TPythonDump() << _this() << ".SetAngleMesh( " << theValue << " )";
424 //=============================================================================
426 * BLSURFPlugin_Hypothesis_i::GetAngleMesh
430 //=============================================================================
431 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMesh()
433 return this->GetImpl()->GetAngleMesh();
436 //=============================================================================
438 * BLSURFPlugin_Hypothesis_i::SetChordalError
442 //=============================================================================
443 void BLSURFPlugin_Hypothesis_i::SetChordalError(CORBA::Double theValue)
445 this->GetImpl()->SetChordalError(theValue);
446 SMESH::TPythonDump() << _this() << ".SetChordalError( " << theValue << " )";
449 //=============================================================================
451 * BLSURFPlugin_Hypothesis_i::GetChordalError
455 //=============================================================================
456 CORBA::Double BLSURFPlugin_Hypothesis_i::GetChordalError()
458 return this->GetImpl()->GetChordalError();
461 //=============================================================================
463 * BLSURFPlugin_Hypothesis_i::SetAnisotropic
467 //=============================================================================
468 void BLSURFPlugin_Hypothesis_i::SetAnisotropic(CORBA::Boolean theValue)
470 this->GetImpl()->SetAnisotropic(theValue);
471 std::string theValueStr = theValue ? "True" : "False";
472 SMESH::TPythonDump() << _this() << ".SetAnisotropic( " << theValueStr.c_str() << " )";
475 //=============================================================================
477 * BLSURFPlugin_Hypothesis_i::GetAnisotropic
481 //=============================================================================
482 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetAnisotropic()
484 return this->GetImpl()->GetAnisotropic();
487 //=============================================================================
489 * BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio
491 * Set Anisotropic Ratio
493 //=============================================================================
494 void BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio(CORBA::Double theValue)
496 this->GetImpl()->SetAnisotropicRatio(theValue);
497 SMESH::TPythonDump() << _this() << ".SetAnisotropicRatio( " << theValue << " )";
500 //=============================================================================
502 * BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio
504 * Get Anisotropic Ratio
506 //=============================================================================
507 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio()
509 return this->GetImpl()->GetAnisotropicRatio();
513 //=============================================================================
515 * BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges
519 //=============================================================================
520 void BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges(CORBA::Boolean theValue) {
522 this->GetImpl()->SetRemoveTinyEdges(theValue);
523 std::string theValueStr = theValue ? "True" : "False";
524 SMESH::TPythonDump() << _this() << ".SetRemoveTinyEdges( " << theValueStr.c_str() << " )";
527 //=============================================================================
529 * BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges
533 //=============================================================================
534 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges() {
536 return this->GetImpl()->GetRemoveTinyEdges();
539 //=============================================================================
541 * BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength
543 * Set Tiny Edge Length
545 //=============================================================================
546 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength(CORBA::Double theValue) {
548 this->GetImpl()->SetTinyEdgeLength(theValue);
549 SMESH::TPythonDump() << _this() << ".SetTinyEdgeLength( " << theValue << " )";
552 //=============================================================================
554 * BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength
556 * Get Tiny Edge Length
558 //=============================================================================
559 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength() {
561 return this->GetImpl()->GetTinyEdgeLength();
564 //=============================================================================
566 * BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges
570 //=============================================================================
571 void BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges(CORBA::Boolean theValue) {
573 this->GetImpl()->SetOptimiseTinyEdges(theValue);
574 std::string theValueStr = theValue ? "True" : "False";
575 SMESH::TPythonDump() << _this() << ".SetOptimiseTinyEdges( " << theValueStr.c_str() << " )";
578 //=============================================================================
580 * BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges
584 //=============================================================================
585 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges() {
587 return this->GetImpl()->GetOptimiseTinyEdges();
590 //=============================================================================
592 * BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength
594 * Set Tiny Edge OptimisationLength
596 //=============================================================================
597 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength(CORBA::Double theValue) {
599 this->GetImpl()->SetTinyEdgeOptimisationLength(theValue);
600 SMESH::TPythonDump() << _this() << ".SetTinyEdgeOptimisationLength( " << theValue << " )";
603 //=============================================================================
605 * BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength
607 * Get Tiny Edge OptimisationLength
609 //=============================================================================
610 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength() {
612 return this->GetImpl()->GetTinyEdgeOptimisationLength();
615 //=============================================================================
617 * BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection
621 //=============================================================================
622 void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection(CORBA::Boolean theValue) {
624 this->GetImpl()->SetCorrectSurfaceIntersection(theValue);
625 std::string theValueStr = theValue ? "True" : "False";
626 SMESH::TPythonDump() << _this() << ".SetCorrectSurfaceIntersection( " << theValueStr.c_str() << " )";
629 //=============================================================================
631 * BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection
635 //=============================================================================
636 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection() {
638 return this->GetImpl()->GetCorrectSurfaceIntersection();
641 //=============================================================================
643 * BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost
645 * Set Tiny Edge OptimisationLength
647 //=============================================================================
648 void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost(CORBA::Double theValue) {
650 this->GetImpl()->SetCorrectSurfaceIntersectionMaxCost(theValue);
651 SMESH::TPythonDump() << _this() << ".SetCorrectSurfaceIntersectionMaxCost( " << theValue << " )";
654 //=============================================================================
656 * BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost
658 * Get Tiny Edge OptimisationLength
660 //=============================================================================
661 CORBA::Double BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost() {
663 return this->GetImpl()->GetCorrectSurfaceIntersectionMaxCost();
666 //=============================================================================
668 * BLSURFPlugin_Hypothesis_i::SetBadElementRemoval
672 //=============================================================================
673 void BLSURFPlugin_Hypothesis_i::SetBadElementRemoval(CORBA::Boolean theValue) {
675 this->GetImpl()->SetBadElementRemoval(theValue);
676 std::string theValueStr = theValue ? "True" : "False";
677 SMESH::TPythonDump() << _this() << ".SetBadElementRemoval( " << theValueStr.c_str() << " )";
680 //=============================================================================
682 * BLSURFPlugin_Hypothesis_i::GetBadElementRemoval
686 //=============================================================================
687 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetBadElementRemoval() {
689 return this->GetImpl()->GetBadElementRemoval();
692 //=============================================================================
694 * BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio
696 * Set Bad Surface Element Aspect Ratio
698 //=============================================================================
699 void BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio(CORBA::Double theValue) {
701 this->GetImpl()->SetBadElementAspectRatio(theValue);
702 SMESH::TPythonDump() << _this() << ".SetBadElementAspectRatio( " << theValue << " )";
705 //=============================================================================
707 * BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio
709 * Get Bad Surface Element Aspect Ratio
711 //=============================================================================
712 CORBA::Double BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio() {
714 return this->GetImpl()->GetBadElementAspectRatio();
717 //=============================================================================
719 * BLSURFPlugin_Hypothesis_i::SetOptimizeMesh
723 //=============================================================================
724 void BLSURFPlugin_Hypothesis_i::SetOptimizeMesh(CORBA::Boolean theValue) {
726 this->GetImpl()->SetOptimizeMesh(theValue);
727 std::string theValueStr = theValue ? "True" : "False";
728 SMESH::TPythonDump() << _this() << ".SetOptimizeMesh( " << theValueStr.c_str() << " )";
731 //=============================================================================
733 * BLSURFPlugin_Hypothesis_i::GetOptimizeMesh
737 //=============================================================================
738 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimizeMesh() {
740 return this->GetImpl()->GetOptimizeMesh();
743 //=============================================================================
745 * BLSURFPlugin_Hypothesis_i::SetQuadraticMesh
749 //=============================================================================
750 void BLSURFPlugin_Hypothesis_i::SetQuadraticMesh(CORBA::Boolean theValue) {
752 this->GetImpl()->SetQuadraticMesh(theValue);
753 std::string theValueStr = theValue ? "True" : "False";
754 SMESH::TPythonDump() << _this() << ".SetQuadraticMesh( " << theValueStr.c_str() << " )";
757 //=============================================================================
759 * BLSURFPlugin_Hypothesis_i::GetQuadraticMesh
763 //=============================================================================
764 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadraticMesh() {
766 return this->GetImpl()->GetQuadraticMesh();
774 * BLSURFPlugin_Hypothesis_i::SetTopology
779 //=============================================================================
780 void BLSURFPlugin_Hypothesis_i::SetTopology(CORBA::Long theValue) {
782 this->GetImpl()->SetTopology((::BLSURFPlugin_Hypothesis::Topology) theValue);
783 SMESH::TPythonDump() << _this() << ".SetTopology( " << theValue << " )";
786 //=============================================================================
788 * BLSURFPlugin_Hypothesis_i::GetTopology
792 //=============================================================================
793 CORBA::Long BLSURFPlugin_Hypothesis_i::GetTopology() {
795 return this->GetImpl()->GetTopology();
798 //=============================================================================
800 * Activate/deactivate surface proximity computation
802 void BLSURFPlugin_Hypothesis_i::SetSurfaceProximity( CORBA::Boolean toUse )
804 if ( GetSurfaceProximity() != toUse )
806 this->GetImpl()->SetUseSurfaceProximity( toUse );
807 SMESH::TPythonDump() << _this() << ".SetSurfaceProximity( " << toUse << " )";
811 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetSurfaceProximity()
813 return this->GetImpl()->GetUseSurfaceProximity();
816 //=============================================================================
818 * Set number of surface element layers to be generated due to surface proximity
820 void BLSURFPlugin_Hypothesis_i::SetNbSurfaceProximityLayers( CORBA::Short nbLayers )
822 if ( GetNbSurfaceProximityLayers() != nbLayers )
824 this->GetImpl()->SetNbSurfaceProximityLayers( nbLayers );
825 SMESH::TPythonDump() << _this() << ".SetNbSurfaceProximityLayers( " << nbLayers << " )";
829 CORBA::Short BLSURFPlugin_Hypothesis_i::GetNbSurfaceProximityLayers()
831 return this->GetImpl()->GetNbSurfaceProximityLayers();
834 //=============================================================================
836 * Set coefficient by which size of element refined due to surface proximity is increased
838 void BLSURFPlugin_Hypothesis_i::SetSurfaceProximityRatio( CORBA::Double ratio )
840 if ( GetSurfaceProximityRatio() != ratio )
842 this->GetImpl()->SetSurfaceProximityRatio( ratio );
843 SMESH::TPythonDump() << _this() << ".SetSurfaceProximityRatio( " << ratio << " )";
847 CORBA::Double BLSURFPlugin_Hypothesis_i::GetSurfaceProximityRatio()
849 return this->GetImpl()->GetSurfaceProximityRatio();
852 //=============================================================================
854 * Activate/deactivate volume proximity computation
856 void BLSURFPlugin_Hypothesis_i::SetVolumeProximity( CORBA::Boolean toUse )
858 if ( GetVolumeProximity() != toUse )
860 this->GetImpl()->SetUseVolumeProximity( toUse );
861 SMESH::TPythonDump() << _this() << ".SetVolumeProximity( " << toUse << " )";
865 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetVolumeProximity()
867 return this->GetImpl()->GetUseVolumeProximity();
871 //=============================================================================
873 * Set number of surface element layers to be generated due to volume proximity
875 void BLSURFPlugin_Hypothesis_i::SetNbVolumeProximityLayers( CORBA::Short nbLayers )
877 if ( GetNbVolumeProximityLayers() != nbLayers )
879 this->GetImpl()->SetNbVolumeProximityLayers( nbLayers );
880 SMESH::TPythonDump() << _this() << ".SetNbVolumeProximityLayers( " << nbLayers << " )";
884 CORBA::Short BLSURFPlugin_Hypothesis_i::GetNbVolumeProximityLayers()
886 return this->GetImpl()->GetNbVolumeProximityLayers();
889 //=============================================================================
891 * Set coefficient by which size of element refined due to volume proximity is increased
893 void BLSURFPlugin_Hypothesis_i::SetVolumeProximityRatio( CORBA::Double ratio )
895 if ( GetVolumeProximityRatio() != ratio )
897 this->GetImpl()->SetVolumeProximityRatio( ratio );
898 SMESH::TPythonDump() << _this() << ".SetVolumeProximityRatio( " << ratio << " )";
902 CORBA::Double BLSURFPlugin_Hypothesis_i::GetVolumeProximityRatio()
904 return this->GetImpl()->GetVolumeProximityRatio();
907 //=============================================================================
908 void BLSURFPlugin_Hypothesis_i::SetVerbosity(CORBA::Short theVal) {
910 if (theVal < 0 || theVal > 100)
911 THROW_SALOME_CORBA_EXCEPTION( "Invalid verbosity level",SALOME::BAD_PARAM );
912 this->GetImpl()->SetVerbosity(theVal);
913 SMESH::TPythonDump() << _this() << ".SetVerbosity( " << theVal << " )";
916 //=============================================================================
918 CORBA::Short BLSURFPlugin_Hypothesis_i::GetVerbosity() {
920 return (CORBA::Short) this->GetImpl()->GetVerbosity();
923 //=============================================================================
924 void BLSURFPlugin_Hypothesis_i::SetEnforceCadEdgesSize( CORBA::Boolean toEnforce )
926 if ( GetEnforceCadEdgesSize() != toEnforce )
928 this->GetImpl()->SetEnforceCadEdgesSize(toEnforce);
929 SMESH::TPythonDump() << _this() << ".SetEnforceCadEdgesSize( " << toEnforce << " )";
932 //=============================================================================
933 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetEnforceCadEdgesSize()
935 return this->GetImpl()->GetEnforceCadEdgesSize();
937 //=============================================================================
939 void BLSURFPlugin_Hypothesis_i::SetJacobianRectificationRespectGeometry( CORBA::Boolean allowRectification )
941 if ( GetJacobianRectificationRespectGeometry() != allowRectification )
943 this->GetImpl()->SetJacobianRectificationRespectGeometry(allowRectification);
944 SMESH::TPythonDump() << _this() << ".SetJacobianRectificationRespectGeometry( " << allowRectification << " )";
947 //=============================================================================
948 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetJacobianRectificationRespectGeometry()
950 return this->GetImpl()->GetJacobianRectificationRespectGeometry();
952 //=============================================================================
954 void BLSURFPlugin_Hypothesis_i::SetJacobianRectification( CORBA::Boolean allowRectification )
956 if ( GetJacobianRectification() != allowRectification )
958 this->GetImpl()->SetJacobianRectification(allowRectification);
959 SMESH::TPythonDump() << _this() << ".SetJacobianRectification( " << allowRectification << " )";
962 //=============================================================================
963 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetJacobianRectification()
965 return this->GetImpl()->GetJacobianRectification();
967 //=============================================================================
969 void BLSURFPlugin_Hypothesis_i::SetUseDeprecatedPatchMesher( CORBA::Boolean useDeprecatedPatchMesher )
971 if ( GetUseDeprecatedPatchMesher() != useDeprecatedPatchMesher )
973 this->GetImpl()->SetUseDeprecatedPatchMesher(useDeprecatedPatchMesher);
974 SMESH::TPythonDump() << _this() << ".SetUseDeprecatedPatchMesher( " << useDeprecatedPatchMesher << " )";
977 //=============================================================================
978 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseDeprecatedPatchMesher()
980 return this->GetImpl()->GetUseDeprecatedPatchMesher();
982 //=============================================================================
984 void BLSURFPlugin_Hypothesis_i::SetMaxNumberOfPointsPerPatch( CORBA::Long nb )
986 if ( GetMaxNumberOfPointsPerPatch() != nb )
989 this->GetImpl()->SetMaxNumberOfPointsPerPatch(nb);
991 } catch (const std::invalid_argument& ex) {
992 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
993 } catch (SALOME_Exception& ex) {
994 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
996 SMESH::TPythonDump() << _this() << ".SetMaxNumberOfPointsPerPatch( " << nb << " )";
999 //=============================================================================
1000 CORBA::Long BLSURFPlugin_Hypothesis_i::GetMaxNumberOfPointsPerPatch()
1002 return this->GetImpl()->GetMaxNumberOfPointsPerPatch();
1004 //=============================================================================
1006 void BLSURFPlugin_Hypothesis_i::SetMaxNumberOfThreads( CORBA::Long nb )
1008 if ( GetMaxNumberOfThreads() != nb )
1011 this->GetImpl()->SetMaxNumberOfThreads(nb);
1013 } catch (const std::invalid_argument& ex) {
1014 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1015 } catch (SALOME_Exception& ex) {
1016 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1018 SMESH::TPythonDump() << _this() << ".SetMaxNumberOfThreads( " << nb << " )";
1021 //=============================================================================
1022 CORBA::Long BLSURFPlugin_Hypothesis_i::GetMaxNumberOfThreads()
1024 return this->GetImpl()->GetMaxNumberOfThreads();
1026 //=============================================================================
1028 void BLSURFPlugin_Hypothesis_i::SetRespectGeometry( CORBA::Boolean toRespect )
1030 if ( GetRespectGeometry() != toRespect )
1032 this->GetImpl()->SetRespectGeometry(toRespect);
1033 SMESH::TPythonDump() << _this() << ".SetRespectGeometry( " << toRespect << " )";
1036 //=============================================================================
1037 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRespectGeometry()
1039 return this->GetImpl()->GetRespectGeometry();
1041 //=============================================================================
1043 void BLSURFPlugin_Hypothesis_i::SetTinyEdgesAvoidSurfaceIntersections( CORBA::Boolean toAvoidIntersection )
1045 if ( GetTinyEdgesAvoidSurfaceIntersections() != toAvoidIntersection )
1047 this->GetImpl()->SetTinyEdgesAvoidSurfaceIntersections(toAvoidIntersection);
1048 SMESH::TPythonDump() << _this() << ".SetTinyEdgesAvoidSurfaceIntersections( " << toAvoidIntersection << " )";
1051 //=============================================================================
1052 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetTinyEdgesAvoidSurfaceIntersections()
1054 return this->GetImpl()->GetTinyEdgesAvoidSurfaceIntersections();
1056 //=============================================================================
1058 void BLSURFPlugin_Hypothesis_i::SetClosedGeometry( CORBA::Boolean isClosed )
1060 if ( GetClosedGeometry() != isClosed )
1062 this->GetImpl()->SetClosedGeometry(isClosed);
1063 SMESH::TPythonDump() << _this() << ".SetClosedGeometry( " << isClosed << " )";
1066 //=============================================================================
1067 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetClosedGeometry()
1069 return this->GetImpl()->GetClosedGeometry();
1071 //=============================================================================
1073 void BLSURFPlugin_Hypothesis_i::SetDebug( CORBA::Boolean isDebug )
1075 if ( GetDebug() != isDebug )
1077 this->GetImpl()->SetDebug(isDebug);
1078 SMESH::TPythonDump() << _this() << ".SetDebug( " << isDebug << " )";
1081 //=============================================================================
1082 bool BLSURFPlugin_Hypothesis_i::GetDebug()
1084 return this->GetImpl()->GetDebug();
1086 //=============================================================================
1088 void BLSURFPlugin_Hypothesis_i::SetPeriodicTolerance( CORBA::Double tol )
1091 if ( GetImpl()->GetPreCADOptionValue("periodic_tolerance",&isDefault) != SMESH_Comment( tol ))
1095 this->GetImpl()->SetPeriodicTolerance(tol);
1097 } catch (const std::invalid_argument& ex) {
1098 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1099 } catch (SALOME_Exception& ex) {
1100 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1102 SMESH::TPythonDump() << _this() << ".SetPeriodicTolerance( " << tol << " )";
1105 //=============================================================================
1106 double BLSURFPlugin_Hypothesis_i::GetPeriodicTolerance()
1109 return this->GetImpl()->GetPeriodicTolerance();
1111 } catch (const std::invalid_argument& ex) {
1112 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1113 } catch (SALOME_Exception& ex) {
1114 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1118 //=============================================================================
1120 void BLSURFPlugin_Hypothesis_i::SetRequiredEntities( const char* howToTreat )
1122 if ( GetImpl()->GetRequiredEntities() != howToTreat )
1125 this->GetImpl()->SetRequiredEntities(howToTreat);
1127 } catch (const std::invalid_argument& ex) {
1128 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1129 } catch (SALOME_Exception& ex) {
1130 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1132 SMESH::TPythonDump() << _this() << ".SetRequiredEntities( '" << howToTreat << "' )";
1135 //=============================================================================
1136 char* BLSURFPlugin_Hypothesis_i::GetRequiredEntities()
1138 return CORBA::string_dup( this->GetImpl()->GetRequiredEntities().c_str() );
1140 //=============================================================================
1142 void BLSURFPlugin_Hypothesis_i::SetSewingTolerance( CORBA::Double tol )
1145 if ( GetImpl()->GetPreCADOptionValue("sewing_tolerance",&isDefault) != SMESH_Comment( tol ))
1149 this->GetImpl()->SetSewingTolerance(tol);
1150 SMESH::TPythonDump() << _this() << ".SetSewingTolerance( " << tol << " )";
1152 } catch (const std::invalid_argument& ex) {
1153 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1154 } catch (SALOME_Exception& ex) {
1155 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1159 //=============================================================================
1160 CORBA::Double BLSURFPlugin_Hypothesis_i::GetSewingTolerance()
1164 return this->GetImpl()->GetSewingTolerance();
1166 } catch (const std::invalid_argument& ex) {
1167 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1168 } catch (SALOME_Exception& ex) {
1169 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1173 //=============================================================================
1175 void BLSURFPlugin_Hypothesis_i::SetTags( const char* howToTreat )
1177 if ( GetImpl()->GetTags() != howToTreat )
1180 this->GetImpl()->SetTags(howToTreat);
1182 catch (const std::invalid_argument& ex) {
1183 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1184 } catch (SALOME_Exception& ex) {
1185 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1188 SMESH::TPythonDump() << _this() << ".SetTags( '" << howToTreat << "' )";
1190 //=============================================================================
1191 char* BLSURFPlugin_Hypothesis_i::GetTags()
1193 return CORBA::string_dup( this->GetImpl()->GetTags().c_str() );
1196 //=============================================================================
1197 void BLSURFPlugin_Hypothesis_i::SetHyperPatches(const BLSURFPlugin::THyperPatchList& hpl)
1199 ::BLSURFPlugin_Hypothesis::THyperPatchList patchList( hpl.length() );
1200 SMESH_Comment hplDump;
1202 for ( size_t i = 0; i < patchList.size(); ++i )
1205 BLSURFPlugin::THyperPatch tags = hpl[ i ];
1206 for ( CORBA::ULong j = 0; j < tags.length(); ++j )
1208 patchList[ i ].insert( tags[ j ]);
1209 hplDump << tags[ j ] << ( j+1 < tags.length() ? ", " : " ]" );
1211 hplDump << ( i+1 < patchList.size() ? "," : "]");
1213 if ( GetImpl()->GetHyperPatches() != patchList )
1215 GetImpl()->SetHyperPatches( patchList );
1216 SMESH::TPythonDump() << _this() << ".SetHyperPatches( " << hplDump << " )";
1220 //=============================================================================
1221 BLSURFPlugin::THyperPatchList* BLSURFPlugin_Hypothesis_i::GetHyperPatches()
1223 const ::BLSURFPlugin_Hypothesis::THyperPatchList& hpl = GetImpl()->GetHyperPatches();
1224 BLSURFPlugin::THyperPatchList* resHpl = new BLSURFPlugin::THyperPatchList();
1225 resHpl->length( hpl.size() );
1227 ::BLSURFPlugin_Hypothesis::THyperPatchList::const_iterator hpIt = hpl.begin();
1228 for ( int i = 0; hpIt != hpl.end(); ++hpIt, ++i )
1230 const ::BLSURFPlugin_Hypothesis::THyperPatchTags& hp = *hpIt;
1231 BLSURFPlugin::THyperPatch& resHp = (*resHpl)[ i ];
1232 resHp.length( hp.size() );
1234 ::BLSURFPlugin_Hypothesis::THyperPatchTags::const_iterator tag = hp.begin();
1235 for ( int j = 0; tag != hp.end(); ++tag, ++j )
1241 //=============================================================================
1243 * BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges
1247 //=============================================================================
1248 void BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges(CORBA::Boolean theValue) {
1250 this->GetImpl()->SetPreCADMergeEdges(theValue);
1251 std::string theValueStr = theValue ? "True" : "False";
1252 SMESH::TPythonDump() << _this() << ".SetPreCADMergeEdges( " << theValueStr.c_str() << " )";
1255 //=============================================================================
1257 * BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges
1261 //=============================================================================
1262 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges() {
1264 return this->GetImpl()->GetPreCADMergeEdges();
1267 //=============================================================================
1269 * BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces
1273 //=============================================================================
1274 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue) {
1276 this->GetImpl()->SetPreCADRemoveDuplicateCADFaces(theValue);
1277 std::string theValueStr = theValue ? "True" : "False";
1278 SMESH::TPythonDump() << _this() << ".SetPreCADRemoveDuplicateCADFaces( " << theValueStr.c_str() << " )";
1281 //=============================================================================
1283 * BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces
1287 //=============================================================================
1288 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces() {
1290 return this->GetImpl()->GetPreCADRemoveDuplicateCADFaces();
1293 //=============================================================================
1295 * BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology
1299 //=============================================================================
1300 void BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology(CORBA::Boolean theValue) {
1302 this->GetImpl()->SetPreCADProcess3DTopology(theValue);
1303 std::string theValueStr = theValue ? "True" : "False";
1304 SMESH::TPythonDump() << _this() << ".SetPreCADProcess3DTopology( " << theValueStr.c_str() << " )";
1307 //=============================================================================
1309 * BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology
1313 //=============================================================================
1314 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology() {
1316 return this->GetImpl()->GetPreCADProcess3DTopology();
1319 //=============================================================================
1321 * BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput
1325 //=============================================================================
1326 void BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput(CORBA::Boolean theValue) {
1328 this->GetImpl()->SetPreCADDiscardInput(theValue);
1329 std::string theValueStr = theValue ? "True" : "False";
1330 SMESH::TPythonDump() << _this() << ".SetPreCADDiscardInput( " << theValueStr.c_str() << " )";
1333 //=============================================================================
1335 * BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput
1339 //=============================================================================
1340 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput() {
1342 return this->GetImpl()->GetPreCADDiscardInput();
1346 //=============================================================================
1348 void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
1352 std::string name( optionName );
1353 if ( !optionValue || !optionValue[0] )
1354 UnsetOption( optionName );
1356 // basic options (visible in Advanced table)
1358 else if ( name == "enforce_cad_edge_sizes" )
1359 SetEnforceCadEdgesSize( GetImpl()->ToBool( optionValue ));
1361 else if ( name == "jacobian_rectification_respect_geometry" )
1362 SetJacobianRectificationRespectGeometry( GetImpl()->ToBool( optionValue ));
1364 else if ( name == "max_number_of_points_per_patch" )
1365 SetMaxNumberOfPointsPerPatch( GetImpl()->ToInt( optionValue ));
1367 else if ( name == "max_number_of_threads" )
1368 SetMaxNumberOfThreads( GetImpl()->ToInt( optionValue ));
1370 else if ( name == "rectify_jacobian" )
1371 SetJacobianRectification( GetImpl()->ToBool( optionValue ));
1373 else if ( name == "use_deprecated_patch_mesher" )
1374 SetUseDeprecatedPatchMesher( GetImpl()->ToBool( optionValue ));
1376 else if ( name == "respect_geometry" )
1377 SetRespectGeometry( GetImpl()->ToBool( optionValue ));
1379 else if ( name == "tiny_edge_avoid_surface_intersections" )
1380 SetTinyEdgesAvoidSurfaceIntersections( GetImpl()->ToBool( optionValue ));
1382 else if ( name == "closed_geometry" )
1383 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1385 else if ( name == "debug" )
1386 SetDebug( GetImpl()->ToBool( optionValue ));
1388 else if ( name == "discard_input_topology" )
1389 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1391 else if ( name == "merge_edges" )
1392 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1394 else if ( name == "periodic_tolerance" )
1395 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1397 else if ( name == "remove_duplicate_cad_faces" )
1398 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1400 else if ( name == "required_entities" )
1401 SetRequiredEntities( optionValue );
1403 else if ( name == "sewing_tolerance" )
1404 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1406 else if ( name == "tags" )
1407 SetTags( optionValue );
1409 // other basic options with specific methods
1411 else if ( name == "correct_surface_intersections" )
1412 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1414 else if ( name == "optimise_tiny_edges" )
1415 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1417 else if ( name == "surface_intersections_processing_max_cost" )
1418 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1420 else if ( name == "volume_gradation" )
1421 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1423 else if ( name == "tiny_edge_optimisation_length" )
1424 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1426 else if ( name == "proximity" )
1427 SetVolumeProximity( GetImpl()->ToBool( optionValue ));
1429 else if ( name == "prox_ratio" )
1430 SetVolumeProximityRatio( GetImpl()->ToDbl( optionValue ));
1432 else if ( name == "prox_nb_layer" )
1433 SetNbVolumeProximityLayers( GetImpl()->ToInt( optionValue ));
1435 // advanced options (for backward compatibility)
1437 else if ( name == "create_tag_on_collision" ||
1438 name == "tiny_edge_respect_geometry" )
1439 AddOption( optionName, optionValue );
1443 valueChanged = ( this->GetImpl()->GetOptionValue( name ) != optionValue &&
1444 this->GetImpl()->GetOptionValue( name, &valueChanged ) != optionValue );
1447 this->GetImpl()->SetOptionValue(optionName, optionValue);
1448 SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
1451 } catch (const std::invalid_argument& ex) {
1452 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1453 } catch (SALOME_Exception& ex) {
1454 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1458 //=============================================================================
1460 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, const char* optionValue)
1463 bool valueChanged = false;
1465 std::string name( optionName );
1466 if ( !optionValue || !optionValue[0] )
1467 UnsetOption( optionName );
1469 else if ( name == "closed_geometry" )
1470 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1472 else if ( name == "debug" )
1473 SetDebug( GetImpl()->ToBool( optionValue ));
1475 else if ( name == "discard_input_topology" )
1476 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1478 else if ( name == "merge_edges" )
1479 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1481 else if ( name == "periodic_tolerance" )
1482 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1484 else if ( name == "remove_duplicate_cad_faces" )
1485 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1487 else if ( name == "required_entities" )
1488 SetRequiredEntities( optionValue );
1490 else if ( name == "sewing_tolerance" )
1491 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1493 else if ( name == "tags" )
1494 SetTags( optionValue );
1496 // other basic options with specific methods
1498 else if ( name == "correct_surface_intersections" )
1499 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1501 else if ( name == "optimise_tiny_edges" )
1502 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1504 else if ( name == "surface_intersections_processing_max_cost" )
1505 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1507 else if ( name == "volume_gradation" )
1508 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1510 else if ( name == "tiny_edge_optimisation_length" )
1511 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1513 else if ( name == "process_3d_topology" )
1514 SetPreCADProcess3DTopology( GetImpl()->ToBool( optionValue ));
1516 // advanced options (for backward compatibility)
1518 else if ( name == "create_tag_on_collision" ||
1519 name == "tiny_edge_respect_geometry" ||
1520 name == "remove_tiny_edges" ||
1521 name == "tiny_edge_length")
1522 AddPreCADOption( optionName, optionValue );
1525 valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue);
1527 this->GetImpl()->SetPreCADOptionValue(optionName, optionValue);
1529 } catch (const std::invalid_argument& ex) {
1530 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1531 } catch (SALOME_Exception& ex) {
1532 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1535 SMESH::TPythonDump() << _this() << ".SetPreCADOptionValue( '" << optionName << "', '" << optionValue << "' )";
1538 //=============================================================================
1540 char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName) {
1544 return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName,&isDefault).c_str());
1545 } catch (const std::invalid_argument& ex) {
1546 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1547 } catch (SALOME_Exception& ex) {
1548 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1553 //=============================================================================
1555 char* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValue(const char* optionName) {
1559 return CORBA::string_dup(this->GetImpl()->GetPreCADOptionValue(optionName,&isDefault).c_str());
1560 } catch (const std::invalid_argument& ex) {
1561 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1562 } catch (SALOME_Exception& ex) {
1563 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1568 //=============================================================================
1570 void BLSURFPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
1572 if ( !GetImpl()->GetOptionValue( optionName ).empty() )
1574 this->GetImpl()->ClearOption(optionName);
1575 SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
1579 //=============================================================================
1581 void BLSURFPlugin_Hypothesis_i::UnsetPreCADOption(const char* optionName) {
1583 if ( !GetImpl()->GetPreCADOptionValue( optionName ).empty() )
1585 this->GetImpl()->ClearPreCADOption(optionName);
1586 SMESH::TPythonDump() << _this() << ".UnsetPreCADOption( '" << optionName << "' )";
1590 //=============================================================================
1592 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() {
1594 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1596 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
1597 result->length(opts.size());
1601 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1602 for (; opIt != opts.end(); ++opIt, ++i) {
1603 string name_value_type = opIt->first;
1604 if (!opIt->second.empty()) {
1605 name_value_type += ":";
1606 name_value_type += GetImpl()->GetOptionValue( opIt->first, &isDefault );
1607 name_value_type += isDefault ? ":0" : ":1";
1609 result[i] = CORBA::string_dup(name_value_type.c_str());
1612 return result._retn();
1615 //=============================================================================
1617 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() {
1619 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1621 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
1622 result->length(opts.size());
1626 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1627 for (; opIt != opts.end(); ++opIt, ++i) {
1628 string name_value_type = opIt->first;
1629 if (!opIt->second.empty()) {
1630 name_value_type += ":";
1631 name_value_type += GetImpl()->GetPreCADOptionValue( opIt->first, &isDefault );
1632 name_value_type += isDefault ? ":0" : ":1";
1634 result[i] = CORBA::string_dup(name_value_type.c_str());
1636 return result._retn();
1639 //=============================================================================
1641 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAdvancedOptionValues()
1643 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1645 const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
1646 result->length(custom_opts.size());
1649 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = custom_opts.begin();
1650 for (; opIt != custom_opts.end(); ++opIt, ++i) {
1651 string name_value_type = opIt->first;
1652 if (!opIt->second.empty()) {
1653 name_value_type += ":";
1654 name_value_type += opIt->second;
1655 name_value_type += ":1"; // user defined
1657 result[i] = CORBA::string_dup(name_value_type.c_str());
1659 return result._retn();
1662 //=============================================================================
1664 void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
1667 for (CORBA::ULong i = 0; i < options.length(); ++i) {
1668 string name_value_type = options[i].in();
1669 if(name_value_type.empty())
1671 size_t colonPos = name_value_type.find(':');
1673 if (colonPos == string::npos) // ':' not found
1674 name = name_value_type;
1676 name = name_value_type.substr(0, colonPos);
1677 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1678 string value_type = name_value_type.substr(colonPos + 1);
1679 colonPos = value_type.find(':');
1680 value = value_type.substr(0, colonPos);
1681 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1682 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1686 SetOptionValue(name.c_str(), value.c_str());
1690 //=============================================================================
1692 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string_array& options)
1695 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1696 string name_value_type = options[i].in();
1697 if(name_value_type.empty())
1699 size_t colonPos = name_value_type.find(':');
1701 if (colonPos == string::npos) // ':' not found
1702 name = name_value_type;
1704 name = name_value_type.substr(0, colonPos);
1705 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1706 string value_type = name_value_type.substr(colonPos + 1);
1707 colonPos = value_type.find(':');
1708 value = value_type.substr(0, colonPos);
1709 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1710 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1714 SetPreCADOptionValue(name.c_str(), value.c_str());
1718 //=============================================================================
1720 void BLSURFPlugin_Hypothesis_i::SetAdvancedOptionValues(const BLSURFPlugin::string_array& options)
1722 SMESH::TPythonDump dump;
1724 string optionsAndValues;
1725 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1726 string name_value_type = options[i].in();
1727 if(name_value_type.empty())
1729 size_t colonPos = name_value_type.find(':');
1731 if (colonPos == string::npos) // ':' not found
1732 name = name_value_type;
1734 name = name_value_type.substr(0, colonPos);
1735 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1736 string value_type = name_value_type.substr(colonPos + 1);
1737 colonPos = value_type.find(':');
1738 value = value_type.substr(0, colonPos);
1741 AddOption(name.c_str(), value.c_str());
1743 optionsAndValues += name + " " + value + " ";
1746 if ( !optionsAndValues.empty() )
1747 dump << _this() << ".SetAdvancedOptions( '" << optionsAndValues.c_str() << "' )";
1750 //=============================================================================
1752 void BLSURFPlugin_Hypothesis_i::SetAdvancedOption(const char* optionsAndValues)
1754 if ( !optionsAndValues ) return;
1756 SMESH::TPythonDump dump;
1758 std::istringstream strm( optionsAndValues );
1759 std::istream_iterator<std::string> sIt( strm ), sEnd;
1760 while ( sIt != sEnd )
1762 std::string option = *sIt;
1763 if ( ++sIt != sEnd )
1765 std::string value = *sIt;
1767 AddOption( option.c_str(), value.c_str() );
1771 THROW_SALOME_CORBA_EXCEPTION( "Uneven number of options and values" ,SALOME::BAD_PARAM );
1774 dump << _this() << ".SetAdvancedOption( '" << optionsAndValues << "' )";
1777 //=============================================================================
1779 void BLSURFPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
1781 // backward compatibility
1783 std::string name( optionName );
1784 if ( name == "proximity" )
1785 SetVolumeProximity( GetImpl()->ToBool( optionValue ));
1787 else if ( name == "prox_ratio" )
1788 SetVolumeProximityRatio( GetImpl()->ToDbl( optionValue ));
1790 else if ( name == "prox_nb_layer" )
1791 SetNbVolumeProximityLayers( GetImpl()->ToInt( optionValue ));
1793 bool valueChanged = (this->GetImpl()->GetOption(optionName) != optionValue);
1795 this->GetImpl()->AddOption(optionName, optionValue);
1796 SMESH::TPythonDump() << _this() << ".AddOption( '" << optionName << "', '" << optionValue << "' )";
1800 //=============================================================================
1802 void BLSURFPlugin_Hypothesis_i::AddPreCADOption(const char* optionName, const char* optionValue)
1805 bool valueChanged = (this->GetImpl()->GetPreCADOption(optionName) != optionValue);
1807 this->GetImpl()->AddPreCADOption(optionName, optionValue);
1808 SMESH::TPythonDump() << _this() << ".AddPreCADOption( '" << optionName << "', '" << optionValue << "' )";
1812 //=============================================================================
1814 char* BLSURFPlugin_Hypothesis_i::GetOption(const char* optionName)
1817 return CORBA::string_dup(this->GetImpl()->GetOption(optionName).c_str());
1820 //=============================================================================
1822 char* BLSURFPlugin_Hypothesis_i::GetPreCADOption(const char* optionName)
1825 return CORBA::string_dup(this->GetImpl()->GetPreCADOption(optionName).c_str());
1828 //=============================================================================
1830 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
1833 if ( !entry || !entry[0] )
1834 THROW_SALOME_CORBA_EXCEPTION( "SetSizeMapEntry(): empty geom entry", SALOME::BAD_PARAM );
1835 bool valueChanged = false;
1837 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap);
1839 this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
1840 } catch (const std::invalid_argument& ex) {
1841 SALOME::ExceptionStruct ExDescription;
1842 ExDescription.text = ex.what();
1843 ExDescription.type = SALOME::BAD_PARAM;
1844 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1845 ExDescription.lineNumber = 0;
1846 throw SALOME::SALOME_Exception(ExDescription);
1847 } catch (SALOME_Exception& ex) {
1848 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1851 SMESH::TPythonDump() << _this() << ".SetSizeMap(" << entry << ", '" << sizeMap << "' )";
1854 //=============================================================================
1856 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap)
1859 bool valueChanged = false;
1860 std::ostringstream sizeMapFunction;
1861 switch (shapeType) {
1862 case GEOM::FACE: sizeMapFunction << "def f(u,v): return " << sizeMap ; break;
1863 case GEOM::EDGE: sizeMapFunction << "def f(t): return " << sizeMap ; break;
1864 case GEOM::VERTEX: sizeMapFunction << "def f(): return " << sizeMap ; break;
1868 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str());
1870 this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str());
1871 } catch (const std::invalid_argument& ex) {
1872 SALOME::ExceptionStruct ExDescription;
1873 ExDescription.text = ex.what();
1874 ExDescription.type = SALOME::BAD_PARAM;
1875 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1876 ExDescription.lineNumber = 0;
1877 throw SALOME::SALOME_Exception(ExDescription);
1878 } catch (SALOME_Exception& ex) {
1879 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1882 SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", " << sizeMap << " )";
1885 //=============================================================================
1887 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
1890 bool valueChanged = false;
1892 valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
1893 if ( valueChanged ) {
1894 boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
1895 if (!boost::regex_match(string(attractor), re))
1896 throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
1897 this->GetImpl()->SetAttractorEntry(entry, attractor);
1899 } catch (const std::invalid_argument& ex) {
1900 SALOME::ExceptionStruct ExDescription;
1901 ExDescription.text = ex.what();
1902 ExDescription.type = SALOME::BAD_PARAM;
1903 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
1904 ExDescription.lineNumber = 0;
1905 throw SALOME::SALOME_Exception(ExDescription);
1906 } catch (SALOME_Exception& ex) {
1907 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1910 SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
1913 //=============================================================================
1915 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
1918 //bool valueChanged = false;
1920 this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
1922 catch (const std::invalid_argument& ex) {
1923 SALOME::ExceptionStruct ExDescription;
1924 ExDescription.text = ex.what();
1925 ExDescription.type = SALOME::BAD_PARAM;
1926 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
1927 ExDescription.lineNumber = 0;
1928 throw SALOME::SALOME_Exception(ExDescription);
1929 } catch (SALOME_Exception& ex) {
1930 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1932 //if ( valueChanged )
1933 SMESH::TPythonDump() << _this() << ".SetAttractorGeom( "
1934 << entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
1937 //=============================================================================
1939 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) {
1942 return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
1943 } catch (const std::invalid_argument& ex) {
1944 SALOME::ExceptionStruct ExDescription;
1945 ExDescription.text = ex.what();
1946 ExDescription.type = SALOME::BAD_PARAM;
1947 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
1948 ExDescription.lineNumber = 0;
1949 throw SALOME::SALOME_Exception(ExDescription);
1950 } catch (SALOME_Exception& ex) {
1951 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1956 //=============================================================================
1958 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) {
1961 return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
1962 } catch (const std::invalid_argument& ex) {
1963 SALOME::ExceptionStruct ExDescription;
1964 ExDescription.text = ex.what();
1965 ExDescription.type = SALOME::BAD_PARAM;
1966 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
1967 ExDescription.lineNumber = 0;
1968 throw SALOME::SALOME_Exception(ExDescription);
1969 } catch (SALOME_Exception& ex) {
1970 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1975 // //=============================================================================
1977 // // TODO coder cette fonction (utilis??e pour savoir si la valeur a chang??
1978 // // A finir pour le dump
1979 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
1981 // ASSERT(myBaseImpl);
1983 // return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
1985 // catch (const std::invalid_argument& ex) {
1986 // SALOME::ExceptionStruct ExDescription;
1987 // ExDescription.text = ex.what();
1988 // ExDescription.type = SALOME::BAD_PARAM;
1989 // ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
1990 // ExDescription.lineNumber = 0;
1991 // throw SALOME::SALOME_Exception(ExDescription);
1993 // catch (SALOME_Exception& ex) {
1994 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1999 //=============================================================================
2001 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
2003 this->GetImpl()->ClearEntry(entry);
2004 // SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
2007 //=============================================================================
2009 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
2011 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
2013 const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
2014 result->length(sizeMaps.size());
2016 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
2017 for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
2018 string entry_sizemap = smIt->first;
2019 if (!smIt->second.empty()) {
2020 entry_sizemap += "|";
2021 entry_sizemap += smIt->second;
2023 result[i] = CORBA::string_dup(entry_sizemap.c_str());
2025 return result._retn();
2028 //=============================================================================
2030 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
2032 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
2034 const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
2035 result->length(attractors.size());
2037 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
2038 for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
2039 string entry_attractor = atIt->first;
2040 if (!atIt->second.empty()) {
2041 entry_attractor += "|";
2042 entry_attractor += atIt->second;
2044 result[i] = CORBA::string_dup(entry_attractor.c_str());
2046 return result._retn();
2049 //=============================================================================
2051 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
2054 BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
2056 const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
2057 result->length( attractors.size() );
2059 ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
2060 for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
2061 string faceEntry = atIt->first;
2063 double startSize=0., endSize=0., infDist=0., constDist=0.;
2064 if ( !atIt->second->Empty() ) {
2065 attEntry = atIt->second->GetAttractorEntry();
2066 std::vector<double> params = atIt->second->GetParameters();
2067 startSize = params[0];
2068 endSize = params[1];
2069 infDist = params[2];
2070 constDist = params[3];
2072 result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
2073 result[i].attEntry = CORBA::string_dup(attEntry.c_str());
2074 result[i].startSize = startSize;
2075 result[i].endSize = endSize;
2076 result[i].infDist = infDist;
2077 result[i].constDist = constDist;
2079 return result._retn();
2082 //=============================================================================
2084 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
2087 for ( CORBA::ULong i = 0; i < sizeMaps.length(); ++i) {
2088 string entry_sizemap = sizeMaps[i].in();
2089 size_t colonPos = entry_sizemap.find('|');
2090 string entry, sizemap;
2091 if (colonPos == string::npos) // '|' separator not found
2092 entry = entry_sizemap;
2094 entry = entry_sizemap.substr(0, colonPos);
2095 if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
2096 sizemap = entry_sizemap.substr(colonPos + 1);
2098 this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
2102 //=============================================================================
2104 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
2106 this->GetImpl()->ClearSizeMaps();
2109 //=============================================================================
2111 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
2115 entry = GeomObj->GetStudyEntry();
2116 SetSizeMapEntry(entry.c_str(), sizeMap);
2119 //=============================================================================
2121 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) {
2123 string entry = GeomObj->GetStudyEntry();
2124 GEOM::shape_type shapeType = GeomObj->GetShapeType();
2125 if (shapeType == GEOM::COMPOUND)
2126 shapeType = GeomObj->GetMaxShapeType();
2127 SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
2130 //=============================================================================
2131 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
2134 entry = GeomObj->GetStudyEntry();
2135 UnsetEntry(entry.c_str());
2136 SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
2139 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
2142 entry = GeomObj->GetStudyEntry();
2143 SetAttractorEntry(entry.c_str(), attractor);
2146 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
2149 entry = GeomObj->GetStudyEntry();
2150 UnsetEntry(entry.c_str());
2151 SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
2154 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)
2157 string theFaceEntry;
2159 theFaceEntry = theFace->GetStudyEntry();
2160 theAttEntry = theAttractor->GetStudyEntry();
2162 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2165 if (theFaceEntry.empty()) {
2167 aName += theFace->GetEntry();
2168 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2169 if (!theSFace->_is_nil())
2170 theFaceEntry = theSFace->GetID();
2172 if (theFaceEntry.empty())
2173 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2175 if (theAttEntry.empty()) {
2176 if (theAttractor->GetShapeType() == GEOM::VERTEX)
2178 if (theAttractor->GetShapeType() == GEOM::EDGE)
2180 if (theAttractor->GetShapeType() == GEOM::WIRE)
2182 if (theAttractor->GetShapeType() == GEOM::COMPOUND)
2183 aName = "Compound_";
2184 aName += theAttractor->GetEntry();
2185 SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(NULL, theAttractor, aName.c_str());
2186 if (!theSAtt->_is_nil())
2187 theAttEntry = theSAtt->GetID();
2189 if (theAttEntry.empty())
2190 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2192 TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
2193 TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
2194 SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
2197 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
2198 GEOM::GEOM_Object_ptr theAttractor)
2201 CORBA::String_var theFaceEntry = theFace->GetStudyEntry();
2202 CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
2204 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2207 // if (theFaceEntry.empty()) {
2209 // aName += theFace->GetEntry();
2210 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2211 // if (!theSFace->_is_nil())
2212 // theFaceEntry = theSFace->GetID();
2214 if ( !theFaceEntry.in() || !theFaceEntry.in()[0] ||
2215 !theAttrEntry.in() || !theAttrEntry.in()[0] )
2216 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2218 GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
2219 SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
2220 << theFace << ", " << theAttractor << " )";
2223 void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry,
2224 const char* attractorEntry)
2226 GetImpl()->ClearEntry( faceEntry, attractorEntry );
2227 SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '"
2228 << faceEntry << "', '" << attractorEntry << "' )";
2233 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
2236 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
2239 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap )
2242 char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry)
2245 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
2248 this->GetImpl()->UnsetCustomSizeMap(entry);
2249 SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
2253 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
2258 // ///////////////////////
2259 // // ENFORCED VERTICES //
2260 // ///////////////////////
2264 * Returns the list of enforced vertices for a given Face entry
2265 * @return A map of Face entry / List of enforced vertices
2268 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
2271 BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
2273 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
2274 this->GetImpl()->_GetAllEnforcedVerticesByFace();
2275 resultMap->length(faceEntryEnfVertexListMap.size());
2277 ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
2278 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
2279 for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
2280 BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
2281 new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
2282 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2284 _enfVertexList = it_entry->second;
2285 BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
2286 enfVertexList->length(_enfVertexList.size());
2288 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
2289 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2290 for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
2291 currentEnfVertex = (*it_enfVertex);
2293 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2296 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2299 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2302 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2303 coords->length(currentEnfVertex->coords.size());
2304 for (CORBA::ULong i=0;i<coords->length();i++)
2305 coords[i] = currentEnfVertex->coords[i];
2306 enfVertex->coords = coords;
2309 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2312 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2313 faceEntryList->length(currentEnfVertex->faceEntries.size());
2314 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2315 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2316 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2317 enfVertex->faceEntries = faceEntryList;
2320 msg << "Enforced vertex: \n"
2321 << "Name: " << enfVertex->name << "\n";
2322 if (coords->length())
2323 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2324 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2325 << "Group Name: " << enfVertex->grpName;
2327 enfVertexList[j] = enfVertex;
2329 mapElement->enfVertexList = enfVertexList;
2331 resultMap[i] = mapElement;
2334 return resultMap._retn();
2338 * Returns the list of all enforced vertices
2339 * @return a list of enforced vertices
2342 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
2344 BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
2345 const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
2346 resultMap->length(enfVertexList.size());
2348 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
2349 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2350 for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
2351 currentEnfVertex = (*evlIt);
2352 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2354 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2356 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2358 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2359 coords->length(currentEnfVertex->coords.size());
2360 for (CORBA::ULong ind = 0; ind < coords->length(); ind++)
2361 coords[ind] = currentEnfVertex->coords[ind];
2362 enfVertex->coords = coords;
2364 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2366 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2367 faceEntryList->length(currentEnfVertex->faceEntries.size());
2368 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2369 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2370 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2371 enfVertex->faceEntries = faceEntryList;
2374 msg << "Enforced vertex: \n"
2375 << "Name: " << enfVertex->name << "\n";
2376 if (coords->length())
2377 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2378 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2379 << "Group Name: " << enfVertex->grpName;
2381 resultMap[i] = enfVertex;
2383 return resultMap._retn();
2388 * Returns the list of enforced vertices coords for a given Face entry.
2389 * They are the coords of the "manual" enforced vertices.
2390 * @return A map of Face entry / List of enforced vertices coords
2393 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
2396 BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
2398 const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
2399 resultMap->length(entryCoordsListMap.size());
2401 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
2402 ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
2403 for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
2404 BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
2405 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2407 _coordsList = it_entry->second;
2408 BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
2409 coordsList->length(_coordsList.size());
2411 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
2412 for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
2413 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2414 coords->length((*it_coords).size());
2415 for (CORBA::ULong i=0;i<coords->length();i++)
2416 coords[i] = (*it_coords)[i];
2417 coordsList[j] = coords;
2419 mapElement->coordsList = coordsList;
2421 resultMap[i] = mapElement;
2424 return resultMap._retn();
2428 * Returns a map of enforced vertices coords / enforced vertex.
2429 * They are the coords of the "manual" enforced vertices.
2431 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
2434 BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
2435 const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
2436 this->GetImpl()->_GetAllEnforcedVerticesByCoords();
2437 resultMap->length(coordsEnfVertexMap.size());
2439 ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
2440 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2441 for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
2442 currentEnfVertex = (it_coords->second);
2443 BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
2444 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2445 coords->length(it_coords->first.size());
2446 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2447 coords[ind] = it_coords->first[ind];
2448 mapElement->coords = coords;
2450 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2452 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2454 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2456 BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
2457 coords2->length(currentEnfVertex->coords.size());
2458 for (CORBA::ULong ind=0;ind<coords2->length();ind++)
2459 coords2[ind] = currentEnfVertex->coords[ind];
2460 enfVertex->coords = coords2;
2462 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2464 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2465 faceEntryList->length(currentEnfVertex->faceEntries.size());
2466 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2467 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2468 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2469 enfVertex->faceEntries = faceEntryList;
2471 mapElement->enfVertex = enfVertex;
2473 msg << "Enforced vertex: \n"
2474 << "Name: " << enfVertex->name << "\n";
2475 if (coords->length())
2476 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2477 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2478 << "Group Name: " << enfVertex->grpName;
2480 resultMap[i] = mapElement;
2482 return resultMap._retn();
2486 * Returns the list of enforced vertices entries for a given Face entry.
2487 * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
2488 * @return A map of Face entry / List of enforced vertices geom entries
2491 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
2494 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
2496 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
2497 this->GetImpl()->_GetAllEnfVertexEntriesByFace();
2498 resultMap->length(entryEnfVertexEntryListMap.size());
2500 ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
2501 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
2502 entryEnfVertexEntryListMap.begin();
2503 for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
2504 BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
2505 new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
2506 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2508 _enfVertexEntryList = it_entry->second;
2509 BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
2510 enfVertexEntryList->length(_enfVertexEntryList.size());
2512 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
2513 for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
2514 enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
2516 mapElement->enfVertexEntryList = enfVertexEntryList;
2518 resultMap[i] = mapElement;
2521 return resultMap._retn();
2525 * Returns a map of enforced vertices geom entry / enforced vertex.
2526 * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
2528 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
2531 BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
2532 const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
2533 this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
2534 resultMap->length(enfVertexEntryEnfVertexMap.size());
2536 ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
2537 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2538 for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
2539 currentEnfVertex = it_enfVertexEntry->second;
2540 BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
2541 mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
2543 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2545 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2547 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2549 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2550 coords->length(currentEnfVertex->coords.size());
2551 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2552 coords[ind] = currentEnfVertex->coords[ind];
2553 enfVertex->coords = coords;
2555 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2557 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2558 faceEntryList->length(currentEnfVertex->faceEntries.size());
2559 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2560 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2561 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2562 enfVertex->faceEntries = faceEntryList;
2565 msg << "Enforced vertex: \n"
2566 << "Name: " << enfVertex->name << "\n";
2567 if (coords->length())
2568 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2569 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2570 << "Group Name: " << enfVertex->grpName;
2572 mapElement->enfVertex = enfVertex;
2573 resultMap[i] = mapElement;
2575 return resultMap._retn();
2579 * Erase all enforced vertices
2581 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
2583 this->GetImpl()->ClearAllEnforcedVertices();
2584 SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
2588 * Set/get/unset an enforced vertex on face - OBSOLETE
2590 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2594 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2595 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2598 string theFaceEntry = theFace->GetStudyEntry();
2600 if (theFaceEntry.empty()) {
2601 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2603 if (theFace->GetShapeType() == GEOM::FACE)
2605 if (theFace->GetShapeType() == GEOM::COMPOUND)
2606 aName = "Compound_";
2607 aName += theFace->GetEntry();
2608 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2609 if (!theSFace->_is_nil())
2610 theFaceEntry = theSFace->GetID();
2612 if (theFaceEntry.empty())
2613 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2615 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2616 } catch (SALOME_Exception& ex) {
2617 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2622 * Set/get/unset an enforced vertex with name on face
2624 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2625 CORBA::Double z, const char* theVertexName) {
2628 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2629 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2632 string theFaceEntry = theFace->GetStudyEntry();
2634 if (theFaceEntry.empty()) {
2635 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2637 if (theFace->GetShapeType() == GEOM::FACE)
2639 if (theFace->GetShapeType() == GEOM::COMPOUND)
2640 aName = "Compound_";
2641 aName += theFace->GetEntry();
2642 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2643 if (!theSFace->_is_nil())
2644 theFaceEntry = theSFace->GetID();
2646 if (theFaceEntry.empty())
2647 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2650 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
2651 } catch (SALOME_Exception& ex) {
2652 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2657 * Set/get/unset an enforced vertex with geom object on face
2659 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2663 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2664 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2667 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2668 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2671 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2672 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
2673 // if (CORBA::is_nil(measureOp))
2676 // CORBA::Double x, y, z;
2678 // measureOp->PointCoordinates(theVertex, x, y, z);
2680 string theFaceEntry = theFace->GetStudyEntry();
2681 string theVertexEntry = theVertex->GetStudyEntry();
2683 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2686 if (theFaceEntry.empty()) {
2687 if (theFace->GetShapeType() == GEOM::FACE)
2689 if (theFace->GetShapeType() == GEOM::COMPOUND)
2690 aName = "Compound_";
2691 aName += theFace->GetEntry();
2692 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2693 if (!theSFace->_is_nil())
2694 theFaceEntry = theSFace->GetID();
2696 if (theFaceEntry.empty())
2697 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2699 if (theVertexEntry.empty()) {
2700 if (theVertex->GetShapeType() == GEOM::VERTEX)
2702 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2703 aName = "Compound_";
2704 aName += theVertex->GetEntry();
2705 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
2706 if (!theSVertex->_is_nil())
2707 theVertexEntry = theSVertex->GetID();
2709 if (theVertexEntry.empty())
2710 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2712 string theVertexName = theVertex->GetName();
2714 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
2715 } catch (SALOME_Exception& ex) {
2716 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2721 * Set an enforced vertex with group name on face
2723 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
2727 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2728 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2731 string theFaceEntry = theFace->GetStudyEntry();
2733 if (theFaceEntry.empty()) {
2734 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2736 if (theFace->GetShapeType() == GEOM::FACE)
2738 if (theFace->GetShapeType() == GEOM::COMPOUND)
2739 aName = "Compound_";
2740 aName += theFace->GetEntry();
2741 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2742 if (!theSFace->_is_nil())
2743 theFaceEntry = theSFace->GetID();
2745 if (theFaceEntry.empty())
2746 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2748 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
2749 } catch (SALOME_Exception& ex) {
2750 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2755 * Set an enforced vertex with name and group name on face
2757 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z,
2758 const char* theVertexName, const char* theGroupName)
2762 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2763 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2766 string theFaceEntry = theFace->GetStudyEntry();
2768 if (theFaceEntry.empty()) {
2769 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2771 if (theFace->GetShapeType() == GEOM::FACE)
2773 if (theFace->GetShapeType() == GEOM::COMPOUND)
2774 aName = "Compound_";
2775 aName += theFace->GetEntry();
2776 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2777 if (!theSFace->_is_nil())
2778 theFaceEntry = theSFace->GetID();
2780 if (theFaceEntry.empty())
2781 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2783 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
2784 } catch (SALOME_Exception& ex) {
2785 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2790 * Set an enforced vertex with geom entry and group name on face
2792 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
2796 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2797 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2800 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2801 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2804 string theFaceEntry = theFace->GetStudyEntry();
2805 string theVertexEntry = theVertex->GetStudyEntry();
2807 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2810 if (theFaceEntry.empty()) {
2811 if (theFace->GetShapeType() == GEOM::FACE)
2813 if (theFace->GetShapeType() == GEOM::COMPOUND)
2814 aName = "Compound_";
2815 aName += theFace->GetEntry();
2816 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2817 if (!theSFace->_is_nil())
2818 theFaceEntry = theSFace->GetID();
2820 if (theFaceEntry.empty())
2821 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2823 if (theVertexEntry.empty()) {
2824 if (theVertex->GetShapeType() == GEOM::VERTEX)
2826 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2827 aName = "Compound_";
2828 aName += theVertex->GetEntry();
2829 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
2830 if (!theSVertex->_is_nil())
2831 theVertexEntry = theSVertex->GetID();
2833 if (theVertexEntry.empty())
2834 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2836 string theVertexName = theVertex->GetName();
2838 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
2839 } catch (SALOME_Exception& ex) {
2840 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2844 //Enable internal enforced vertices on specific face if requested by user
2846 // * Are internal enforced vertices used for a face ?
2848 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
2850 // ASSERT(myBaseImpl);
2852 // if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2853 // THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2856 // string theFaceEntry = theFace->GetStudyEntry();
2858 // if (theFaceEntry.empty()) {
2859 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2861 // if (theFace->GetShapeType() == GEOM::FACE)
2863 // if (theFace->GetShapeType() == GEOM::COMPOUND)
2864 // aName = "Compound_";
2865 // aName += theFace->GetEntry();
2866 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2867 // if (!theSFace->_is_nil())
2868 // theFaceEntry = theSFace->GetID();
2870 // if (theFaceEntry.empty())
2871 // THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2874 // return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
2875 // } catch (SALOME_Exception& ex) {
2876 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2881 * Get the list of all enforced vertices
2883 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
2887 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2888 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2891 string theFaceEntry = theFace->GetStudyEntry();
2893 if (theFaceEntry.empty()) {
2894 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2896 if (theFace->GetShapeType() == GEOM::FACE)
2898 if (theFace->GetShapeType() == GEOM::COMPOUND)
2899 aName = "Compound_";
2900 aName += theFace->GetEntry();
2901 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2902 if (!theSFace->_is_nil())
2903 theFaceEntry = theSFace->GetID();
2905 if (theFaceEntry.empty())
2906 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2909 return GetEnforcedVerticesEntry(theFaceEntry.c_str());
2910 } catch (SALOME_Exception& ex) {
2911 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2915 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2919 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2920 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2923 string theFaceEntry = theFace->GetStudyEntry();
2925 if (theFaceEntry.empty()) {
2926 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2928 if (theFace->GetShapeType() == GEOM::FACE)
2930 if (theFace->GetShapeType() == GEOM::COMPOUND)
2931 aName = "Compound_";
2932 aName += theFace->GetEntry();
2933 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2934 if (!theSFace->_is_nil())
2935 theFaceEntry = theSFace->GetID();
2937 if (theFaceEntry.empty())
2938 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2941 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2942 } catch (SALOME_Exception& ex) {
2943 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2947 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2951 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2952 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2954 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2955 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2958 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2959 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
2960 // if (CORBA::is_nil(measureOp))
2963 // CORBA::Double x, y, z;
2965 // measureOp->PointCoordinates(theVertex, x, y, z);
2967 std::string theFaceEntry = theFace->GetStudyEntry();
2968 std::string theVertexEntry = theVertex->GetStudyEntry();
2970 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2973 if (theFaceEntry.empty()) {
2974 if (theFace->GetShapeType() == GEOM::FACE)
2976 if (theFace->GetShapeType() == GEOM::COMPOUND)
2977 aName = "Compound_";
2978 aName += theFace->GetEntry();
2979 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2980 if (!theSFace->_is_nil())
2981 theFaceEntry = theSFace->GetID();
2983 if (theFaceEntry.empty())
2984 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2986 if (theVertexEntry.empty()) {
2987 if (theVertex->GetShapeType() == GEOM::VERTEX)
2989 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2990 aName = "Compound_";
2991 aName += theVertex->GetEntry();
2992 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
2993 if (!theSVertex->_is_nil())
2994 theVertexEntry = theSVertex->GetID();
2996 if (theVertexEntry.empty())
2997 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3001 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
3002 } catch (SALOME_Exception& ex) {
3003 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3007 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) {
3010 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
3011 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
3014 string theFaceEntry = theFace->GetStudyEntry();
3016 if (theFaceEntry.empty()) {
3017 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
3019 if (theFace->GetShapeType() == GEOM::FACE)
3021 if (theFace->GetShapeType() == GEOM::COMPOUND)
3022 aName = "Compound_";
3023 aName += theFace->GetEntry();
3024 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
3025 if (!theSFace->_is_nil())
3026 theFaceEntry = theSFace->GetID();
3028 if (theFaceEntry.empty())
3029 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3033 return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
3034 } catch (SALOME_Exception& ex) {
3035 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3040 * Set/get/unset an enforced vertex on face - NEW (no face)
3042 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
3047 return SetEnforcedVertexEntry("", x, y, z);
3048 } catch (SALOME_Exception& ex) {
3049 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3054 * Set/get/unset an enforced vertex with name on face
3056 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName)
3059 return SetEnforcedVertexEntry("", x, y, z, theVertexName);
3060 } catch (SALOME_Exception& ex) {
3061 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3066 * Set/get/unset an enforced vertex with geom object on face
3068 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
3070 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3071 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3073 string theVertexEntry = theVertex->GetStudyEntry();
3075 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theVertex );
3078 if (theVertexEntry.empty()) {
3079 if (theVertex->GetShapeType() == GEOM::VERTEX)
3081 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3082 aName = "Compound_";
3083 aName += theVertex->GetEntry();
3084 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
3085 if (!theSVertex->_is_nil())
3086 theVertexEntry = theSVertex->GetID();
3088 if (theVertexEntry.empty())
3089 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3091 string theVertexName = theVertex->GetName();
3093 return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
3094 } catch (SALOME_Exception& ex) {
3095 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3100 * Set an enforced vertex with group name on face
3102 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
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)
3122 return SetEnforcedVertexEntry("", x, y, z, theVertexName, "", theGroupName);
3123 } catch (SALOME_Exception& ex) {
3124 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3129 * Set an enforced vertex with geom entry and group name on face
3131 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
3133 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3134 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3137 string theVertexEntry = theVertex->GetStudyEntry();
3139 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theVertex );
3142 if (theVertexEntry.empty()) {
3143 if (theVertex->GetShapeType() == GEOM::VERTEX)
3145 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3146 aName = "Compound_";
3147 aName += theVertex->GetEntry();
3148 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
3149 if (!theSVertex->_is_nil())
3150 theVertexEntry = theSVertex->GetID();
3152 if (theVertexEntry.empty())
3153 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3155 string theVertexName = theVertex->GetName();
3157 return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
3158 } catch (SALOME_Exception& ex) {
3159 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3163 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
3166 return UnsetEnforcedVertexEntry("", x, y, z);
3167 } catch (SALOME_Exception& ex) {
3168 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3172 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
3174 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3175 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3177 std::string theVertexEntry = theVertex->GetStudyEntry();
3179 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theVertex );
3182 if (theVertexEntry.empty()) {
3183 if (theVertex->GetShapeType() == GEOM::VERTEX)
3185 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3186 aName = "Compound_";
3187 aName += theVertex->GetEntry();
3188 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
3189 if (!theSVertex->_is_nil())
3190 theVertexEntry = theSVertex->GetID();
3192 if (theVertexEntry.empty())
3193 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3196 return UnsetEnforcedVertexEntry("", 0, 0, 0, theVertexEntry.c_str());
3197 } catch (SALOME_Exception& ex) {
3198 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3202 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertices()
3205 return UnsetEnforcedVerticesEntry("");
3206 } catch (SALOME_Exception& ex) {
3207 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3212 * Set/get/unset an enforced vertex on geom object given by entry
3214 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry,
3218 const char* theVertexName,
3219 const char* theVertexEntry,
3220 const char* theGroupName)
3222 bool newValue = false;
3223 if (string(theVertexEntry).empty()) {
3225 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
3226 this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
3227 ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
3228 coords.push_back(x);
3229 coords.push_back(y);
3230 coords.push_back(z);
3231 if (coordsList.find(coords) == coordsList.end()) {
3234 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
3235 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3239 } catch (const std::invalid_argument& ex) {
3240 // no enforced vertex for entry
3244 if (string(theVertexName).empty()) {
3245 if (string(theGroupName).empty())
3246 SMESH::TPythonDump() << _this() << ".AddEnforcedVertex(" << x << ", " << y << ", " << z << ")";
3248 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
3251 if (string(theGroupName).empty())
3252 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
3254 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", \""
3255 << theVertexName << "\", \"" << theGroupName << "\")";
3260 ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
3261 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
3262 if ( it == enfVertexEntryList.end()) {
3266 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
3267 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3271 } catch (const std::invalid_argument& ex) {
3272 // no enforced vertex for entry
3276 if (string(theGroupName).empty())
3277 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeom(" << theVertexEntry << ")";
3279 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeomWithGroup(" << theVertexEntry << ", \"" << theGroupName << "\")";
3284 this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
3289 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
3292 BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
3293 ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
3294 vertexList->length(_vList.size());
3295 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
3296 for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
3297 ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
3299 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
3302 enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
3303 // Geom Vertex Entry
3304 enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
3306 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
3307 coords->length(_enfVertex->coords.size());
3308 for ( CORBA::ULong ind = 0; ind < coords->length(); ind++ )
3309 coords[ind] = _enfVertex->coords[ind];
3310 enfVertex->coords = coords;
3312 enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
3314 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
3315 faceEntryList->length(_enfVertex->faceEntries.size());
3316 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
3317 for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
3318 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
3319 enfVertex->faceEntries = faceEntryList;
3321 vertexList[i] = enfVertex;
3323 return vertexList._retn();
3324 } catch (const std::invalid_argument& ex) {
3325 SALOME::ExceptionStruct ExDescription;
3326 ExDescription.text = ex.what();
3327 ExDescription.type = SALOME::BAD_PARAM;
3328 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
3329 ExDescription.lineNumber = 1385;
3330 throw SALOME::SALOME_Exception(ExDescription);
3331 } catch (const std::exception& ex) {
3332 std::cout << "Exception: " << ex.what() << std::endl;
3333 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3337 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexEntry)
3343 res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
3345 if (string(theVertexEntry).empty())
3346 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertex(" << x << ", " << y << ", " << z
3349 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom(" << theVertexEntry << ")";
3351 } catch (const std::invalid_argument& ex) {
3353 } catch (const std::exception& ex) {
3354 std::cout << "Exception: " << ex.what() << std::endl;
3355 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3360 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry)
3365 this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
3366 SMESH::TPythonDump() << _this() << ".RemoveEnforcedVertices()";
3367 } catch (const std::invalid_argument& ex) {
3369 } catch (const std::exception& ex) {
3370 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3376 //=============================================================================
3378 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
3382 //=============================================================================
3383 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue)
3386 this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
3387 std::string theValueStr = theValue ? "True" : "False";
3388 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
3391 //=============================================================================
3393 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
3397 //=============================================================================
3398 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces()
3401 return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
3404 //=============================================================================
3406 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
3410 //=============================================================================
3411 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName)
3414 this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
3415 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
3418 //=============================================================================
3420 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
3424 //=============================================================================
3425 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup()
3428 return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
3432 * Enable internal enforced vertices on specific face if requested by user
3434 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
3437 SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
3438 } catch (SALOME_Exception& ex) {
3439 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3443 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3445 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
3446 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
3449 string theFaceEntry = theFace->GetStudyEntry();
3451 if (theFaceEntry.empty()) {
3452 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
3453 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3455 if (theFace->GetShapeType() == GEOM::FACE)
3457 if (theFace->GetShapeType() == GEOM::COMPOUND)
3458 aName = "Compound_";
3459 aName += theFace->GetEntry();
3460 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
3461 if (!theSFace->_is_nil())
3462 theFaceEntry = theSFace->GetID();
3464 if (theFaceEntry.empty())
3465 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3468 SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
3469 } catch (SALOME_Exception& ex) {
3470 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3474 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3478 this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
3479 std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
3480 if (string(theGroupName).empty())
3481 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
3483 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
3484 } catch (const std::exception& ex) {
3485 std::cout << "Exception: " << ex.what() << std::endl;
3486 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3493 char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
3498 return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
3500 catch (const std::invalid_argument& ex) {
3501 SALOME::ExceptionStruct ExDescription;
3502 ExDescription.text = ex.what();
3503 ExDescription.type = SALOME::BAD_PARAM;
3504 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
3505 ExDescription.lineNumber = 1146;
3506 throw SALOME::SALOME_Exception(ExDescription);
3508 catch (SALOME_Exception& ex) {
3509 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3515 void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
3519 this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
3521 catch (const std::invalid_argument& ex) {
3522 SALOME::ExceptionStruct ExDescription;
3523 ExDescription.text = ex.what();
3524 ExDescription.type = SALOME::BAD_PARAM;
3525 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
3526 ExDescription.lineNumber = 1170;
3527 throw SALOME::SALOME_Exception(ExDescription);
3529 catch (SALOME_Exception& ex) {
3530 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3533 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
3534 << x << ", " << y << ", " << z << ", '" << groupName << "' )";
3538 ///////////////////////
3540 ///////////////////////
3542 ///////////////////////
3545 std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
3547 std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
3548 MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
3549 MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
3550 MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID");
3551 MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL");
3552 MapShapeTypeToString[GEOM::FACE] = std::string("FACE");
3553 MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE");
3554 MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE");
3555 MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX");
3556 MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE");
3557 std::string txtShapeType = MapShapeTypeToString[theShapeType];
3558 return txtShapeType;
3561 void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes)
3563 // Check shape types
3565 std::stringstream typesTxt;
3566 for (std::size_t i=0; i<theShapeTypes.size(); i++)
3568 GEOM::shape_type theShapeType = theShapeTypes[i];
3569 if (shape->GetShapeType() == theShapeType)
3571 typesTxt << ShapeTypeToString(theShapeType);
3572 if (i < theShapeTypes.size()-1 )
3576 std::stringstream msg;
3577 msg << "shape type is not in" << typesTxt.str();
3578 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3582 void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType)
3585 if (shape->GetShapeType() != theShapeType) {
3586 std::stringstream msg;
3587 msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
3588 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3592 std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix)
3594 // Check shape is published in the object browser
3595 string shapeEntry = shape->GetStudyEntry();
3597 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( shape );
3600 // Publish shape if needed
3601 if (shapeEntry.empty()) {
3602 if (shape->GetShapeType() == theShapeType)
3604 aName += shape->GetEntry();
3605 SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(NULL, shape, aName.c_str());
3606 if (!theSFace1->_is_nil())
3607 shapeEntry = theSFace1->GetID();
3609 if (shapeEntry.empty())
3610 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3614 // Format the output of two vectors to use it in MESSAGE and PythonDump
3615 std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
3617 std::stringstream listEntriesTxt;
3619 if (!theSourceVerticesEntries.empty())
3621 listEntriesTxt << ", [" ;
3623 for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
3626 listEntriesTxt << ", ";
3627 listEntriesTxt << *it;
3630 listEntriesTxt << "], [" ;
3632 for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
3635 listEntriesTxt << ", ";
3636 listEntriesTxt << *it;
3638 listEntriesTxt << "]" ;
3640 return listEntriesTxt.str();
3644 * Erase all PreCad periodicity associations
3646 void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
3648 this->GetImpl()->ClearPreCadPeriodicityVectors();
3649 SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
3652 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
3654 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3655 this->GetImpl()->_GetPreCadFacesPeriodicityVector();
3657 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3659 return periodicityList._retn();
3662 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
3664 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3665 this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
3667 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3669 return periodicityList._retn();
3672 // convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
3673 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
3675 BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
3677 periodicityList->length(preCadPeriodicityVector.size());
3679 for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
3681 ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
3683 BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
3684 myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
3685 myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
3687 BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
3688 if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
3690 sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
3691 for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
3692 sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
3695 myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
3697 BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
3698 if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
3700 targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
3701 for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
3702 targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
3705 myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
3707 periodicityList[i] = myPreCadPeriodicity;
3711 return periodicityList._retn();
3715 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
3718 const GEOM::ListOfGO theSourceVertices;
3719 const GEOM::ListOfGO theTargetVertices;
3720 AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices);
3724 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
3725 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3729 size_t theLength = theSourceVertices.length();
3730 if (theLength != theTargetVertices.length())
3731 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3733 std::vector<GEOM::shape_type> allowedShapeTypes;
3734 allowedShapeTypes.push_back(GEOM::FACE);
3735 allowedShapeTypes.push_back(GEOM::COMPOUND);
3737 string prefix1 = "Source_face_";
3738 CheckShapeTypes(theFace1, allowedShapeTypes);
3739 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
3741 string prefix2 = "Target_face_";
3742 CheckShapeTypes(theFace2, allowedShapeTypes);
3743 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
3745 string prefix3 = "Source_vertex_";
3746 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3747 theSourceVerticesEntries->length(theLength);
3748 GEOM::GEOM_Object_ptr theVtx_i;
3750 for (size_t ind = 0; ind < theLength; ind++) {
3751 theVtx_i = theSourceVertices[ind];
3752 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3753 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3756 string prefix4 = "Target_vertex_";
3757 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3758 theTargetVerticesEntries->length(theLength);
3759 for (size_t ind = 0; ind < theLength; ind++) {
3760 theVtx_i = theTargetVertices[ind];
3761 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3762 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3765 string theFace2Name = theFace2->GetName();
3767 AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
3768 theSourceVerticesEntries, theTargetVerticesEntries);
3769 } catch (SALOME_Exception& ex) {
3770 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3775 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
3776 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3780 // Convert BLSURFPlugin::TEntryList to vector<string>
3781 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3782 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3783 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3784 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3787 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3790 this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
3791 theSourceVerticesEntries, theTargetVerticesEntries);
3793 SMESH::TPythonDump pd;
3794 if (!theSourceVerticesEntries.empty())
3796 pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
3797 pd << listEntriesTxt.c_str();
3801 pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
3804 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
3807 const GEOM::ListOfGO theSourceVertices;
3808 const GEOM::ListOfGO theTargetVertices;
3809 AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices);
3812 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
3813 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3817 size_t theLength = theSourceVertices.length();
3818 if (theLength != theTargetVertices.length())
3819 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3821 std::vector<GEOM::shape_type> allowedShapeTypes;
3822 allowedShapeTypes.push_back(GEOM::EDGE);
3823 allowedShapeTypes.push_back(GEOM::COMPOUND);
3825 string prefix1 = "Source_edge_";
3826 CheckShapeTypes(theEdge1, allowedShapeTypes);
3827 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1);
3829 string prefix2 = "Target_edge_";
3830 CheckShapeTypes(theEdge2, allowedShapeTypes);
3831 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
3833 string prefix3 = "Source_vertex_";
3834 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3835 theSourceVerticesEntries->length(theLength);
3836 GEOM::GEOM_Object_ptr theVtx_i;
3838 for (size_t ind = 0; ind < theLength; ind++) {
3839 theVtx_i = theSourceVertices[ind];
3840 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3841 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3844 string prefix4 = "Target_vertex_";
3845 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3846 theTargetVerticesEntries->length(theLength);
3847 for (size_t ind = 0; ind < theLength; ind++) {
3848 theVtx_i = theTargetVertices[ind];
3849 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3850 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3853 string theEdge2Name = theEdge2->GetName();
3855 AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
3856 theSourceVerticesEntries, theTargetVerticesEntries);
3857 } catch (SALOME_Exception& ex) {
3858 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3863 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
3864 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3869 // Convert BLSURFPlugin::TEntryList to vector<string>
3870 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3871 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3872 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3873 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3876 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3878 this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
3879 theSourceVerticesEntries, theTargetVerticesEntries);
3881 SMESH::TPythonDump pd;
3882 if (!theSourceVerticesEntries.empty())
3884 pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
3885 pd << listEntriesTxt.c_str();
3889 pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
3894 //================================================================================
3896 * \brief Sets the file for export resulting mesh in GMF format
3897 * \param theFileName - full name of the file (.mesh, .meshb)
3899 * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
3901 //================================================================================
3902 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
3903 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
3905 bool valueChanged/*, modeChanged*/ = false;
3907 valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
3908 // modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
3909 if (valueChanged)// or (!valueChanged && modeChanged))
3910 this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
3911 } catch (const std::exception& ex) {
3912 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3914 if (valueChanged)// or (!valueChanged && modeChanged))
3915 SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
3918 //================================================================================
3920 * \brief Gets the file name for export resulting mesh in GMF format
3921 * \retval char* - The file name
3923 * Returns the GMF file name
3925 //================================================================================
3926 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
3928 return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
3931 // //================================================================================
3933 // * \brief Gets the file mode for export resulting mesh in GMF format
3934 // * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
3936 // * Returns the GMF file mode
3938 // //================================================================================
3939 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
3940 // ASSERT(myBaseImpl);
3941 // return this->GetImpl()->GetGMFFileMode();
3944 //=============================================================================
3946 * BLSURFPlugin_Hypothesis_i::GetImpl
3948 * Get implementation
3950 //=============================================================================
3951 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
3952 return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
3955 //================================================================================
3957 * \brief Verify whether hypothesis supports given entity type
3958 * \param type - dimension (see SMESH::Dimension enumeration)
3959 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
3961 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
3963 //================================================================================
3964 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
3965 return type == SMESH::DIM_2D;
3969 //================================================================================
3971 * \brief Return geometry this hypothesis depends on. Return false if there is no geometry parameter
3973 //================================================================================
3976 BLSURFPlugin_Hypothesis_i::getObjectsDependOn( std::vector< std::string > & entryArray,
3977 std::vector< int > & subIDArray ) const
3979 typedef ::BLSURFPlugin_Hypothesis BH;
3980 const BH* impl = static_cast<const BH*>( myBaseImpl );
3983 const BH::TSizeMap& sizeMap = impl->_GetSizeMapEntries();
3984 BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
3985 for ( ; entry2size != sizeMap.cend(); ++entry2size )
3986 entryArray.push_back( entry2size->first );
3989 const BH::TSizeMap& sizeMap = impl->_GetAttractorEntries();
3990 BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
3991 for ( ; entry2size != sizeMap.cend(); ++entry2size )
3992 entryArray.push_back( entry2size->first );
3995 const BH::TAttractorMap& classAttractors = impl-> _GetClassAttractorEntries();
3996 BH::TAttractorMap::const_iterator entry2size = classAttractors.cbegin();
3997 for ( ; entry2size != classAttractors.cend(); ++entry2size )
3998 entryArray.push_back( entry2size->first );
4001 const BH::TFaceEntryEnfVertexListMap& faceEntryEnfVertexListMap = impl->_GetAllEnforcedVerticesByFace();
4002 BH::TFaceEntryEnfVertexListMap::const_iterator entry2evList = faceEntryEnfVertexListMap.cbegin();
4003 for ( ; entry2evList != faceEntryEnfVertexListMap.cend(); ++entry2evList )
4005 entryArray.push_back( entry2evList->first );
4007 const BH::TEnfVertexList& evList = entry2evList->second;
4008 BH::TEnfVertexList::const_iterator evIt = evList.cbegin();
4009 for ( ; evIt != evList.cend(); ++evIt )
4011 const BH::TEnfVertex* ev = *evIt;
4012 entryArray.push_back( ev->geomEntry );
4013 entryArray.insert( entryArray.end(), ev->faceEntries.cbegin(), ev->faceEntries.cend() );
4017 // { // duplicated data of faceEntryEnfVertexListMap
4018 // const BH::TEnfVertexList& enfVertexList = impl->_GetAllEnforcedVertices();
4019 // const BH::TFaceEntryCoordsListMap& faceEntryCoordsListMap = impl->_GetAllCoordsByFace();
4020 // const BH::TFaceEntryEnfVertexEntryListMap& faceEntryEnfVertexEntryListMap = impl->_GetAllEnfV // const BH::TEnfVertexEntryEnfVertexMap& enfVertexEntryEnfVertexMap = impl->_GetAllEnforcedVert // }
4022 const BH::TPreCadPeriodicityVector& preCadFacesPeriodicityVector = impl->_GetPreCadFacesPeriodicityVector();
4023 BH::TPreCadPeriodicityVector::const_iterator pcp = preCadFacesPeriodicityVector.cbegin();
4024 for ( ; pcp != preCadFacesPeriodicityVector.cend(); ++pcp )
4026 entryArray.push_back( pcp->shape1Entry );
4027 entryArray.push_back( pcp->shape2Entry );
4028 entryArray.insert( entryArray.end(),
4029 pcp->theSourceVerticesEntries.cbegin(),
4030 pcp->theSourceVerticesEntries.cend() );
4031 entryArray.insert( entryArray.end(),
4032 pcp->theTargetVerticesEntries.cbegin(),
4033 pcp->theTargetVerticesEntries.cend() );
4037 const BH::TPreCadPeriodicityVector& preCadEdgesPeriodicityVector = impl->_GetPreCadEdgesPeriodicityVector();
4038 BH::TPreCadPeriodicityVector::const_iterator pcp = preCadEdgesPeriodicityVector.cbegin();
4039 for ( ; pcp != preCadEdgesPeriodicityVector.cend(); ++pcp )
4041 entryArray.push_back( pcp->shape1Entry );
4042 entryArray.push_back( pcp->shape2Entry );
4043 entryArray.insert( entryArray.end(),
4044 pcp->theSourceVerticesEntries.cbegin(),
4045 pcp->theSourceVerticesEntries.cend() );
4046 entryArray.insert( entryArray.end(),
4047 pcp->theTargetVerticesEntries.cbegin(),
4048 pcp->theTargetVerticesEntries.cend() );
4052 const BH::THyperPatchList& hyperPatchList = impl->GetHyperPatches();
4053 BH::THyperPatchList::const_iterator idSet = hyperPatchList.cbegin();
4054 for ( ; idSet != hyperPatchList.cend(); ++idSet )
4056 subIDArray.insert( subIDArray.end(), idSet->cbegin(), idSet->cend() );
4062 //================================================================================
4064 * \brief Set new geometry instead of that returned by getObjectsDependOn()
4066 //================================================================================
4069 BLSURFPlugin_Hypothesis_i::setObjectsDependOn( std::vector< std::string > & entryArray,
4070 std::vector< int > & subIDArray )
4072 typedef ::BLSURFPlugin_Hypothesis BH;
4073 BH* impl = static_cast<BH*>( myBaseImpl );
4077 BH::TSizeMap& sizeMapNew = const_cast< BH::TSizeMap& >( impl->_GetSizeMapEntries() );
4078 BH::TSizeMap sizeMap;
4079 sizeMap.swap( sizeMapNew );
4080 BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
4081 for ( ; entry2size != sizeMap.cend(); ++entry2size, ++iEnt )
4082 if ( entryArray[ iEnt ].empty() == entry2size->first.empty() )
4083 sizeMapNew[ entryArray[ iEnt ]] = entry2size->second;
4086 BH::TSizeMap& sizeMapNew = const_cast< BH::TSizeMap& >( impl->_GetAttractorEntries() );
4087 BH::TSizeMap sizeMap;
4088 sizeMap.swap( sizeMapNew );
4089 BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
4090 for ( ; entry2size != sizeMap.cend(); ++entry2size, ++iEnt )
4091 if ( entryArray[ iEnt ].empty() == entry2size->first.empty() )
4092 sizeMapNew[ entryArray[ iEnt ]] = entry2size->second;
4095 BH::TAttractorMap& attrMapNew =
4096 const_cast< BH::TAttractorMap& > ( impl->_GetClassAttractorEntries() );
4097 BH::TAttractorMap attrMap;
4098 attrMap.swap( attrMapNew );
4099 BH::TAttractorMap::const_iterator entry2size = attrMap.cbegin();
4100 for ( ; entry2size != attrMap.cend(); ++entry2size, ++iEnt )
4101 if ( entryArray[ iEnt ].empty() == entry2size->first.empty() )
4102 attrMapNew.insert( std::make_pair( entryArray[ iEnt ], entry2size->second ));
4104 delete entry2size->second;
4107 BH::TFaceEntryEnfVertexListMap& faceEntryEnfVertexListMapNew =
4108 const_cast< BH::TFaceEntryEnfVertexListMap& >( impl->_GetAllEnforcedVerticesByFace() );
4109 BH::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap;
4110 faceEntryEnfVertexListMap.swap( faceEntryEnfVertexListMapNew );
4112 BH::TEnfVertexList& enfVertexList =
4113 const_cast< BH::TEnfVertexList& > ( impl->_GetAllEnforcedVertices() );
4114 enfVertexList.clear(); // avoid removal
4116 impl->ClearAllEnforcedVertices();
4118 BH::TFaceEntryEnfVertexListMap::iterator entry2evList = faceEntryEnfVertexListMap.begin();
4119 for ( ; entry2evList != faceEntryEnfVertexListMap.end(); ++entry2evList )
4121 const BH::TEntry& entry = entryArray[ iEnt++ ];
4122 bool faceOk = ( entry.empty() == entry2evList->first.empty() );
4124 BH::TEnfVertexList& evList = entry2evList->second;
4125 BH::TEnfVertexList::iterator evIt = evList.begin();
4126 for ( ; evIt != evList.end(); ++evIt )
4128 BH::TEnfVertex* ev = *evIt;
4129 bool ok = faceOk && ( ev->geomEntry.empty() != entryArray[ iEnt ].empty() );
4130 ev->geomEntry = entryArray[ iEnt++ ];
4131 BH::TEntryList faceEntriesNew;
4132 BH::TEntryList::iterator fEnt = ev->faceEntries.begin();
4133 for ( ; fEnt != ev->faceEntries.end(); ++fEnt, ++iEnt )
4135 if ( !entryArray[ iEnt ].empty() )
4136 faceEntriesNew.insert( entryArray[ iEnt ]);
4140 ev->faceEntries.swap( faceEntriesNew );
4141 impl->AddEnforcedVertex( entry, ev );
4151 BH::TPreCadPeriodicityVector& preCadPeriodicityVector =
4152 const_cast< BH::TPreCadPeriodicityVector&> ( impl->_GetPreCadFacesPeriodicityVector() );
4153 BH::TPreCadPeriodicityVector::iterator pcp = preCadPeriodicityVector.begin();
4154 for ( ; pcp != preCadPeriodicityVector.end(); ++pcp )
4156 pcp->shape1Entry = entryArray[ iEnt++ ];
4157 pcp->shape2Entry = entryArray[ iEnt++ ];
4158 for ( size_t i = 0; i < pcp->theSourceVerticesEntries.size(); ++i, iEnt++ )
4159 pcp->theSourceVerticesEntries[i] = entryArray[ iEnt ];
4161 for ( size_t i = 0; i < pcp->theTargetVerticesEntries.size(); ++i, iEnt++ )
4162 pcp->theTargetVerticesEntries[i] = entryArray[ iEnt ];
4166 BH::TPreCadPeriodicityVector& preCadPeriodicityVector =
4167 const_cast< BH::TPreCadPeriodicityVector&> ( impl->_GetPreCadEdgesPeriodicityVector() );
4168 BH::TPreCadPeriodicityVector::iterator pcp = preCadPeriodicityVector.begin();
4169 for ( ; pcp != preCadPeriodicityVector.end(); ++pcp )
4171 pcp->shape1Entry = entryArray[ iEnt++ ];
4172 pcp->shape2Entry = entryArray[ iEnt++ ];
4173 for ( size_t i = 0; i < pcp->theSourceVerticesEntries.size(); ++i, iEnt++ )
4174 pcp->theSourceVerticesEntries[i] = entryArray[ iEnt ];
4176 for ( size_t i = 0; i < pcp->theTargetVerticesEntries.size(); ++i, iEnt++ )
4177 pcp->theTargetVerticesEntries[i] = entryArray[ iEnt ];
4183 BH::THyperPatchList& hyperPatchListNew =
4184 const_cast< BH::THyperPatchList& >( impl->GetHyperPatches() );
4185 BH::THyperPatchList hyperPatchList;
4186 hyperPatchList.swap( hyperPatchListNew );
4187 BH::THyperPatchList::iterator idSet = hyperPatchList.begin();
4188 for ( ; idSet != hyperPatchList.end(); ++idSet )
4190 BH::THyperPatchTags& ids = *idSet;
4191 BH::THyperPatchTags idsNew;
4192 BH::THyperPatchTags::iterator i = ids.begin();
4193 for ( ; i != ids.end(); ++i, ++iID )
4194 if ( subIDArray[ iID ] > 0 )
4195 idsNew.insert( subIDArray[ iID ]);
4196 if ( !idsNew.empty() )
4197 hyperPatchListNew.push_back( idsNew );
4201 return ( iEnt == entryArray.size() && iID == subIDArray.size() );