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)
1982 // ASSERT(myBaseImpl);
1984 // return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
1986 // catch (const std::invalid_argument& ex) {
1987 // SALOME::ExceptionStruct ExDescription;
1988 // ExDescription.text = ex.what();
1989 // ExDescription.type = SALOME::BAD_PARAM;
1990 // ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
1991 // ExDescription.lineNumber = 0;
1992 // throw SALOME::SALOME_Exception(ExDescription);
1994 // catch (SALOME_Exception& ex) {
1995 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2000 //=============================================================================
2002 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
2004 this->GetImpl()->ClearEntry(entry);
2005 // SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
2008 //=============================================================================
2010 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
2012 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
2014 const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
2015 result->length(sizeMaps.size());
2017 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
2018 for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
2019 string entry_sizemap = smIt->first;
2020 if (!smIt->second.empty()) {
2021 entry_sizemap += "|";
2022 entry_sizemap += smIt->second;
2024 result[i] = CORBA::string_dup(entry_sizemap.c_str());
2026 return result._retn();
2029 //=============================================================================
2031 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
2033 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
2035 const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
2036 result->length(attractors.size());
2038 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
2039 for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
2040 string entry_attractor = atIt->first;
2041 if (!atIt->second.empty()) {
2042 entry_attractor += "|";
2043 entry_attractor += atIt->second;
2045 result[i] = CORBA::string_dup(entry_attractor.c_str());
2047 return result._retn();
2050 //=============================================================================
2052 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
2055 BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
2057 const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
2058 result->length( attractors.size() );
2060 ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
2061 for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
2062 string faceEntry = atIt->first;
2064 double startSize=0., endSize=0., infDist=0., constDist=0.; // todo: startSize, endSize, infDist, constDist must be explicitly initialized to avoid warning (see below)
2065 if ( !atIt->second->Empty() ) {
2066 attEntry = atIt->second->GetAttractorEntry();
2067 std::vector<double> params = atIt->second->GetParameters();
2068 startSize = params[0];
2069 endSize = params[1];
2070 infDist = params[2];
2071 constDist = params[3];
2073 result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
2074 result[i].attEntry = CORBA::string_dup(attEntry.c_str());
2075 result[i].startSize = startSize;
2076 result[i].endSize = endSize;
2077 result[i].infDist = infDist;
2078 result[i].constDist = constDist; // todo: startSize, endSize, infDist, constDist must be explicitly initialized to avoid warning (see above)
2080 return result._retn();
2083 //=============================================================================
2085 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
2088 for ( CORBA::ULong i = 0; i < sizeMaps.length(); ++i) {
2089 string entry_sizemap = sizeMaps[i].in();
2090 size_t colonPos = entry_sizemap.find('|');
2091 string entry, sizemap;
2092 if (colonPos == string::npos) // '|' separator not found
2093 entry = entry_sizemap;
2095 entry = entry_sizemap.substr(0, colonPos);
2096 if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
2097 sizemap = entry_sizemap.substr(colonPos + 1);
2099 this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
2103 //=============================================================================
2105 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
2107 this->GetImpl()->ClearSizeMaps();
2110 //=============================================================================
2112 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
2116 entry = GeomObj->GetStudyEntry();
2117 SetSizeMapEntry(entry.c_str(), sizeMap);
2120 //=============================================================================
2122 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) {
2124 string entry = GeomObj->GetStudyEntry();
2125 GEOM::shape_type shapeType = GeomObj->GetShapeType();
2126 if (shapeType == GEOM::COMPOUND)
2127 shapeType = GeomObj->GetMaxShapeType();
2128 SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
2131 //=============================================================================
2132 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
2135 entry = GeomObj->GetStudyEntry();
2136 UnsetEntry(entry.c_str());
2137 SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
2140 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
2143 entry = GeomObj->GetStudyEntry();
2144 SetAttractorEntry(entry.c_str(), attractor);
2147 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
2150 entry = GeomObj->GetStudyEntry();
2151 UnsetEntry(entry.c_str());
2152 SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
2155 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)
2158 string theFaceEntry;
2160 theFaceEntry = theFace->GetStudyEntry();
2161 theAttEntry = theAttractor->GetStudyEntry();
2163 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2166 if (theFaceEntry.empty()) {
2168 aName += theFace->GetEntry();
2169 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2170 if (!theSFace->_is_nil())
2171 theFaceEntry = theSFace->GetID();
2173 if (theFaceEntry.empty())
2174 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2176 if (theAttEntry.empty()) {
2177 if (theAttractor->GetShapeType() == GEOM::VERTEX)
2179 if (theAttractor->GetShapeType() == GEOM::EDGE)
2181 if (theAttractor->GetShapeType() == GEOM::WIRE)
2183 if (theAttractor->GetShapeType() == GEOM::COMPOUND)
2184 aName = "Compound_";
2185 aName += theAttractor->GetEntry();
2186 SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(NULL, theAttractor, aName.c_str());
2187 if (!theSAtt->_is_nil())
2188 theAttEntry = theSAtt->GetID();
2190 if (theAttEntry.empty())
2191 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2193 TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
2194 TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
2195 SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
2198 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
2199 GEOM::GEOM_Object_ptr theAttractor)
2202 CORBA::String_var theFaceEntry = theFace->GetStudyEntry();
2203 CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
2205 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2208 // if (theFaceEntry.empty()) {
2210 // aName += theFace->GetEntry();
2211 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2212 // if (!theSFace->_is_nil())
2213 // theFaceEntry = theSFace->GetID();
2215 if ( !theFaceEntry.in() || !theFaceEntry.in()[0] ||
2216 !theAttrEntry.in() || !theAttrEntry.in()[0] )
2217 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2219 GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
2220 SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
2221 << theFace << ", " << theAttractor << " )";
2224 void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry,
2225 const char* attractorEntry)
2227 GetImpl()->ClearEntry( faceEntry, attractorEntry );
2228 SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '"
2229 << faceEntry << "', '" << attractorEntry << "' )";
2234 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
2237 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
2240 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap )
2243 char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry)
2246 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
2249 this->GetImpl()->UnsetCustomSizeMap(entry);
2250 SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
2254 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
2259 // ///////////////////////
2260 // // ENFORCED VERTICES //
2261 // ///////////////////////
2265 * Returns the list of enforced vertices for a given Face entry
2266 * @return A map of Face entry / List of enforced vertices
2269 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
2272 BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
2274 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
2275 this->GetImpl()->_GetAllEnforcedVerticesByFace();
2276 resultMap->length(faceEntryEnfVertexListMap.size());
2278 ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
2279 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
2280 for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
2281 BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
2282 new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
2283 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2285 _enfVertexList = it_entry->second;
2286 BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
2287 enfVertexList->length(_enfVertexList.size());
2289 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
2290 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2291 for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
2292 currentEnfVertex = (*it_enfVertex);
2294 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2297 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2300 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2303 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2304 coords->length(currentEnfVertex->coords.size());
2305 for (CORBA::ULong i=0;i<coords->length();i++)
2306 coords[i] = currentEnfVertex->coords[i];
2307 enfVertex->coords = coords;
2310 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2313 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2314 faceEntryList->length(currentEnfVertex->faceEntries.size());
2315 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2316 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2317 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2318 enfVertex->faceEntries = faceEntryList;
2321 msg << "Enforced vertex: \n"
2322 << "Name: " << enfVertex->name << "\n";
2323 if (coords->length())
2324 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2325 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2326 << "Group Name: " << enfVertex->grpName;
2328 enfVertexList[j] = enfVertex;
2330 mapElement->enfVertexList = enfVertexList;
2332 resultMap[i] = mapElement;
2335 return resultMap._retn();
2339 * Returns the list of all enforced vertices
2340 * @return a list of enforced vertices
2343 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
2345 BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
2346 const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
2347 resultMap->length(enfVertexList.size());
2349 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
2350 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2351 for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
2352 currentEnfVertex = (*evlIt);
2353 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2355 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2357 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2359 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2360 coords->length(currentEnfVertex->coords.size());
2361 for (CORBA::ULong ind = 0; ind < coords->length(); ind++)
2362 coords[ind] = currentEnfVertex->coords[ind];
2363 enfVertex->coords = coords;
2365 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2367 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2368 faceEntryList->length(currentEnfVertex->faceEntries.size());
2369 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2370 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2371 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2372 enfVertex->faceEntries = faceEntryList;
2375 msg << "Enforced vertex: \n"
2376 << "Name: " << enfVertex->name << "\n";
2377 if (coords->length())
2378 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2379 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2380 << "Group Name: " << enfVertex->grpName;
2382 resultMap[i] = enfVertex;
2384 return resultMap._retn();
2389 * Returns the list of enforced vertices coords for a given Face entry.
2390 * They are the coords of the "manual" enforced vertices.
2391 * @return A map of Face entry / List of enforced vertices coords
2394 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
2397 BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
2399 const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
2400 resultMap->length(entryCoordsListMap.size());
2402 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
2403 ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
2404 for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
2405 BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
2406 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2408 _coordsList = it_entry->second;
2409 BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
2410 coordsList->length(_coordsList.size());
2412 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
2413 for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
2414 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2415 coords->length((*it_coords).size());
2416 for (CORBA::ULong i=0;i<coords->length();i++)
2417 coords[i] = (*it_coords)[i];
2418 coordsList[j] = coords;
2420 mapElement->coordsList = coordsList;
2422 resultMap[i] = mapElement;
2425 return resultMap._retn();
2429 * Returns a map of enforced vertices coords / enforced vertex.
2430 * They are the coords of the "manual" enforced vertices.
2432 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
2435 BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
2436 const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
2437 this->GetImpl()->_GetAllEnforcedVerticesByCoords();
2438 resultMap->length(coordsEnfVertexMap.size());
2440 ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
2441 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2442 for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
2443 currentEnfVertex = (it_coords->second);
2444 BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
2445 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2446 coords->length(it_coords->first.size());
2447 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2448 coords[ind] = it_coords->first[ind];
2449 mapElement->coords = coords;
2451 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2453 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2455 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2457 BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
2458 coords2->length(currentEnfVertex->coords.size());
2459 for (CORBA::ULong ind=0;ind<coords2->length();ind++)
2460 coords2[ind] = currentEnfVertex->coords[ind];
2461 enfVertex->coords = coords2;
2463 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2465 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2466 faceEntryList->length(currentEnfVertex->faceEntries.size());
2467 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2468 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2469 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2470 enfVertex->faceEntries = faceEntryList;
2472 mapElement->enfVertex = enfVertex;
2474 msg << "Enforced vertex: \n"
2475 << "Name: " << enfVertex->name << "\n";
2476 if (coords->length())
2477 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2478 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2479 << "Group Name: " << enfVertex->grpName;
2481 resultMap[i] = mapElement;
2483 return resultMap._retn();
2487 * Returns the list of enforced vertices entries for a given Face entry.
2488 * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
2489 * @return A map of Face entry / List of enforced vertices geom entries
2492 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
2495 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
2497 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
2498 this->GetImpl()->_GetAllEnfVertexEntriesByFace();
2499 resultMap->length(entryEnfVertexEntryListMap.size());
2501 ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
2502 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
2503 entryEnfVertexEntryListMap.begin();
2504 for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
2505 BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
2506 new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
2507 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2509 _enfVertexEntryList = it_entry->second;
2510 BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
2511 enfVertexEntryList->length(_enfVertexEntryList.size());
2513 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
2514 for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
2515 enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
2517 mapElement->enfVertexEntryList = enfVertexEntryList;
2519 resultMap[i] = mapElement;
2522 return resultMap._retn();
2526 * Returns a map of enforced vertices geom entry / enforced vertex.
2527 * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
2529 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
2532 BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
2533 const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
2534 this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
2535 resultMap->length(enfVertexEntryEnfVertexMap.size());
2537 ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
2538 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2539 for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
2540 currentEnfVertex = it_enfVertexEntry->second;
2541 BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
2542 mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
2544 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2546 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2548 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2550 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2551 coords->length(currentEnfVertex->coords.size());
2552 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2553 coords[ind] = currentEnfVertex->coords[ind];
2554 enfVertex->coords = coords;
2556 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2558 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2559 faceEntryList->length(currentEnfVertex->faceEntries.size());
2560 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2561 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2562 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2563 enfVertex->faceEntries = faceEntryList;
2566 msg << "Enforced vertex: \n"
2567 << "Name: " << enfVertex->name << "\n";
2568 if (coords->length())
2569 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2570 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2571 << "Group Name: " << enfVertex->grpName;
2573 mapElement->enfVertex = enfVertex;
2574 resultMap[i] = mapElement;
2576 return resultMap._retn();
2580 * Erase all enforced vertices
2582 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
2584 this->GetImpl()->ClearAllEnforcedVertices();
2585 SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
2589 * Set/get/unset an enforced vertex on face - OBSOLETE
2591 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2595 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2596 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2599 string theFaceEntry = theFace->GetStudyEntry();
2601 if (theFaceEntry.empty()) {
2602 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2604 if (theFace->GetShapeType() == GEOM::FACE)
2606 if (theFace->GetShapeType() == GEOM::COMPOUND)
2607 aName = "Compound_";
2608 aName += theFace->GetEntry();
2609 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2610 if (!theSFace->_is_nil())
2611 theFaceEntry = theSFace->GetID();
2613 if (theFaceEntry.empty())
2614 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2616 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2617 } catch (SALOME_Exception& ex) {
2618 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2623 * Set/get/unset an enforced vertex with name on face
2625 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2626 CORBA::Double z, const char* theVertexName) {
2629 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2630 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2633 string theFaceEntry = theFace->GetStudyEntry();
2635 if (theFaceEntry.empty()) {
2636 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2638 if (theFace->GetShapeType() == GEOM::FACE)
2640 if (theFace->GetShapeType() == GEOM::COMPOUND)
2641 aName = "Compound_";
2642 aName += theFace->GetEntry();
2643 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2644 if (!theSFace->_is_nil())
2645 theFaceEntry = theSFace->GetID();
2647 if (theFaceEntry.empty())
2648 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2651 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
2652 } catch (SALOME_Exception& ex) {
2653 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2658 * Set/get/unset an enforced vertex with geom object on face
2660 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2664 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2665 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2668 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2669 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2672 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2673 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
2674 // if (CORBA::is_nil(measureOp))
2677 // CORBA::Double x, y, z;
2679 // measureOp->PointCoordinates(theVertex, x, y, z);
2681 string theFaceEntry = theFace->GetStudyEntry();
2682 string theVertexEntry = theVertex->GetStudyEntry();
2684 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2687 if (theFaceEntry.empty()) {
2688 if (theFace->GetShapeType() == GEOM::FACE)
2690 if (theFace->GetShapeType() == GEOM::COMPOUND)
2691 aName = "Compound_";
2692 aName += theFace->GetEntry();
2693 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2694 if (!theSFace->_is_nil())
2695 theFaceEntry = theSFace->GetID();
2697 if (theFaceEntry.empty())
2698 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2700 if (theVertexEntry.empty()) {
2701 if (theVertex->GetShapeType() == GEOM::VERTEX)
2703 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2704 aName = "Compound_";
2705 aName += theVertex->GetEntry();
2706 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
2707 if (!theSVertex->_is_nil())
2708 theVertexEntry = theSVertex->GetID();
2710 if (theVertexEntry.empty())
2711 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2713 string theVertexName = theVertex->GetName();
2715 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
2716 } catch (SALOME_Exception& ex) {
2717 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2722 * Set an enforced vertex with group name on face
2724 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
2728 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2729 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2732 string theFaceEntry = theFace->GetStudyEntry();
2734 if (theFaceEntry.empty()) {
2735 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2737 if (theFace->GetShapeType() == GEOM::FACE)
2739 if (theFace->GetShapeType() == GEOM::COMPOUND)
2740 aName = "Compound_";
2741 aName += theFace->GetEntry();
2742 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2743 if (!theSFace->_is_nil())
2744 theFaceEntry = theSFace->GetID();
2746 if (theFaceEntry.empty())
2747 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2749 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
2750 } catch (SALOME_Exception& ex) {
2751 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2756 * Set an enforced vertex with name and group name on face
2758 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z,
2759 const char* theVertexName, const char* theGroupName)
2763 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2764 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2767 string theFaceEntry = theFace->GetStudyEntry();
2769 if (theFaceEntry.empty()) {
2770 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2772 if (theFace->GetShapeType() == GEOM::FACE)
2774 if (theFace->GetShapeType() == GEOM::COMPOUND)
2775 aName = "Compound_";
2776 aName += theFace->GetEntry();
2777 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2778 if (!theSFace->_is_nil())
2779 theFaceEntry = theSFace->GetID();
2781 if (theFaceEntry.empty())
2782 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2784 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
2785 } catch (SALOME_Exception& ex) {
2786 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2791 * Set an enforced vertex with geom entry and group name on face
2793 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
2797 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2798 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2801 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2802 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2805 string theFaceEntry = theFace->GetStudyEntry();
2806 string theVertexEntry = theVertex->GetStudyEntry();
2808 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2811 if (theFaceEntry.empty()) {
2812 if (theFace->GetShapeType() == GEOM::FACE)
2814 if (theFace->GetShapeType() == GEOM::COMPOUND)
2815 aName = "Compound_";
2816 aName += theFace->GetEntry();
2817 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2818 if (!theSFace->_is_nil())
2819 theFaceEntry = theSFace->GetID();
2821 if (theFaceEntry.empty())
2822 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2824 if (theVertexEntry.empty()) {
2825 if (theVertex->GetShapeType() == GEOM::VERTEX)
2827 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2828 aName = "Compound_";
2829 aName += theVertex->GetEntry();
2830 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
2831 if (!theSVertex->_is_nil())
2832 theVertexEntry = theSVertex->GetID();
2834 if (theVertexEntry.empty())
2835 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2837 string theVertexName = theVertex->GetName();
2839 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
2840 } catch (SALOME_Exception& ex) {
2841 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2845 //Enable internal enforced vertices on specific face if requested by user
2847 // * Are internal enforced vertices used for a face ?
2849 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
2851 // ASSERT(myBaseImpl);
2853 // if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2854 // THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2857 // string theFaceEntry = theFace->GetStudyEntry();
2859 // if (theFaceEntry.empty()) {
2860 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2862 // if (theFace->GetShapeType() == GEOM::FACE)
2864 // if (theFace->GetShapeType() == GEOM::COMPOUND)
2865 // aName = "Compound_";
2866 // aName += theFace->GetEntry();
2867 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2868 // if (!theSFace->_is_nil())
2869 // theFaceEntry = theSFace->GetID();
2871 // if (theFaceEntry.empty())
2872 // THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2875 // return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
2876 // } catch (SALOME_Exception& ex) {
2877 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2882 * Get the list of all enforced vertices
2884 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
2888 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2889 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2892 string theFaceEntry = theFace->GetStudyEntry();
2894 if (theFaceEntry.empty()) {
2895 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2897 if (theFace->GetShapeType() == GEOM::FACE)
2899 if (theFace->GetShapeType() == GEOM::COMPOUND)
2900 aName = "Compound_";
2901 aName += theFace->GetEntry();
2902 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2903 if (!theSFace->_is_nil())
2904 theFaceEntry = theSFace->GetID();
2906 if (theFaceEntry.empty())
2907 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2910 return GetEnforcedVerticesEntry(theFaceEntry.c_str());
2911 } catch (SALOME_Exception& ex) {
2912 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2916 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2920 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2921 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2924 string theFaceEntry = theFace->GetStudyEntry();
2926 if (theFaceEntry.empty()) {
2927 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2929 if (theFace->GetShapeType() == GEOM::FACE)
2931 if (theFace->GetShapeType() == GEOM::COMPOUND)
2932 aName = "Compound_";
2933 aName += theFace->GetEntry();
2934 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2935 if (!theSFace->_is_nil())
2936 theFaceEntry = theSFace->GetID();
2938 if (theFaceEntry.empty())
2939 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2942 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2943 } catch (SALOME_Exception& ex) {
2944 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2948 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2952 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2953 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2955 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2956 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2959 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2960 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
2961 // if (CORBA::is_nil(measureOp))
2964 // CORBA::Double x, y, z;
2966 // measureOp->PointCoordinates(theVertex, x, y, z);
2968 std::string theFaceEntry = theFace->GetStudyEntry();
2969 std::string theVertexEntry = theVertex->GetStudyEntry();
2971 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2974 if (theFaceEntry.empty()) {
2975 if (theFace->GetShapeType() == GEOM::FACE)
2977 if (theFace->GetShapeType() == GEOM::COMPOUND)
2978 aName = "Compound_";
2979 aName += theFace->GetEntry();
2980 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2981 if (!theSFace->_is_nil())
2982 theFaceEntry = theSFace->GetID();
2984 if (theFaceEntry.empty())
2985 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2987 if (theVertexEntry.empty()) {
2988 if (theVertex->GetShapeType() == GEOM::VERTEX)
2990 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2991 aName = "Compound_";
2992 aName += theVertex->GetEntry();
2993 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
2994 if (!theSVertex->_is_nil())
2995 theVertexEntry = theSVertex->GetID();
2997 if (theVertexEntry.empty())
2998 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3002 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
3003 } catch (SALOME_Exception& ex) {
3004 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3008 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) {
3011 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
3012 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
3015 string theFaceEntry = theFace->GetStudyEntry();
3017 if (theFaceEntry.empty()) {
3018 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
3020 if (theFace->GetShapeType() == GEOM::FACE)
3022 if (theFace->GetShapeType() == GEOM::COMPOUND)
3023 aName = "Compound_";
3024 aName += theFace->GetEntry();
3025 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
3026 if (!theSFace->_is_nil())
3027 theFaceEntry = theSFace->GetID();
3029 if (theFaceEntry.empty())
3030 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3034 return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
3035 } catch (SALOME_Exception& ex) {
3036 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3041 * Set/get/unset an enforced vertex on face - NEW (no face)
3043 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
3048 return SetEnforcedVertexEntry("", x, y, z);
3049 } catch (SALOME_Exception& ex) {
3050 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3055 * Set/get/unset an enforced vertex with name on face
3057 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName)
3060 return SetEnforcedVertexEntry("", x, y, z, theVertexName);
3061 } catch (SALOME_Exception& ex) {
3062 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3067 * Set/get/unset an enforced vertex with geom object on face
3069 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
3071 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3072 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3074 string theVertexEntry = theVertex->GetStudyEntry();
3076 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theVertex );
3079 if (theVertexEntry.empty()) {
3080 if (theVertex->GetShapeType() == GEOM::VERTEX)
3082 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3083 aName = "Compound_";
3084 aName += theVertex->GetEntry();
3085 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
3086 if (!theSVertex->_is_nil())
3087 theVertexEntry = theSVertex->GetID();
3089 if (theVertexEntry.empty())
3090 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3092 string theVertexName = theVertex->GetName();
3094 return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
3095 } catch (SALOME_Exception& ex) {
3096 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3101 * Set an enforced vertex with group name on face
3103 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
3108 return SetEnforcedVertexEntry("", x, y, z, "", "", theGroupName);
3109 } catch (SALOME_Exception& ex) {
3110 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3115 * Set an enforced vertex with name and group name on face
3117 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z,
3118 const char* theVertexName, const char* theGroupName)
3123 return SetEnforcedVertexEntry("", x, y, z, theVertexName, "", theGroupName);
3124 } catch (SALOME_Exception& ex) {
3125 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3130 * Set an enforced vertex with geom entry and group name on face
3132 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
3134 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3135 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3138 string theVertexEntry = theVertex->GetStudyEntry();
3140 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theVertex );
3143 if (theVertexEntry.empty()) {
3144 if (theVertex->GetShapeType() == GEOM::VERTEX)
3146 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3147 aName = "Compound_";
3148 aName += theVertex->GetEntry();
3149 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
3150 if (!theSVertex->_is_nil())
3151 theVertexEntry = theSVertex->GetID();
3153 if (theVertexEntry.empty())
3154 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3156 string theVertexName = theVertex->GetName();
3158 return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
3159 } catch (SALOME_Exception& ex) {
3160 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3164 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
3167 return UnsetEnforcedVertexEntry("", x, y, z);
3168 } catch (SALOME_Exception& ex) {
3169 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3173 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
3175 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3176 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3178 std::string theVertexEntry = theVertex->GetStudyEntry();
3180 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theVertex );
3183 if (theVertexEntry.empty()) {
3184 if (theVertex->GetShapeType() == GEOM::VERTEX)
3186 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3187 aName = "Compound_";
3188 aName += theVertex->GetEntry();
3189 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
3190 if (!theSVertex->_is_nil())
3191 theVertexEntry = theSVertex->GetID();
3193 if (theVertexEntry.empty())
3194 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3197 return UnsetEnforcedVertexEntry("", 0, 0, 0, theVertexEntry.c_str());
3198 } catch (SALOME_Exception& ex) {
3199 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3203 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertices()
3206 return UnsetEnforcedVerticesEntry("");
3207 } catch (SALOME_Exception& ex) {
3208 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3213 * Set/get/unset an enforced vertex on geom object given by entry
3215 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry,
3219 const char* theVertexName,
3220 const char* theVertexEntry,
3221 const char* theGroupName)
3223 bool newValue = false;
3224 if (string(theVertexEntry).empty()) {
3226 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
3227 this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
3228 ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
3229 coords.push_back(x);
3230 coords.push_back(y);
3231 coords.push_back(z);
3232 if (coordsList.find(coords) == coordsList.end()) {
3235 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
3236 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3240 } catch (const std::invalid_argument& ex) {
3241 // no enforced vertex for entry
3245 if (string(theVertexName).empty()) {
3246 if (string(theGroupName).empty())
3247 SMESH::TPythonDump() << _this() << ".AddEnforcedVertex(" << x << ", " << y << ", " << z << ")";
3249 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
3252 if (string(theGroupName).empty())
3253 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
3255 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", \""
3256 << theVertexName << "\", \"" << theGroupName << "\")";
3261 ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
3262 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
3263 if ( it == enfVertexEntryList.end()) {
3267 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
3268 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3272 } catch (const std::invalid_argument& ex) {
3273 // no enforced vertex for entry
3277 if (string(theGroupName).empty())
3278 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeom(" << theVertexEntry << ")";
3280 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeomWithGroup(" << theVertexEntry << ", \"" << theGroupName << "\")";
3285 this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
3290 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
3293 BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
3294 ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
3295 vertexList->length(_vList.size());
3296 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
3297 for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
3298 ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
3300 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
3303 enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
3304 // Geom Vertex Entry
3305 enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
3307 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
3308 coords->length(_enfVertex->coords.size());
3309 for ( CORBA::ULong ind = 0; ind < coords->length(); ind++ )
3310 coords[ind] = _enfVertex->coords[ind];
3311 enfVertex->coords = coords;
3313 enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
3315 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
3316 faceEntryList->length(_enfVertex->faceEntries.size());
3317 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
3318 for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
3319 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
3320 enfVertex->faceEntries = faceEntryList;
3322 vertexList[i] = enfVertex;
3324 return vertexList._retn();
3325 } catch (const std::invalid_argument& ex) {
3326 SALOME::ExceptionStruct ExDescription;
3327 ExDescription.text = ex.what();
3328 ExDescription.type = SALOME::BAD_PARAM;
3329 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
3330 ExDescription.lineNumber = 1385;
3331 throw SALOME::SALOME_Exception(ExDescription);
3332 } catch (const std::exception& ex) {
3333 std::cout << "Exception: " << ex.what() << std::endl;
3334 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3338 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexEntry)
3344 res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
3346 if (string(theVertexEntry).empty())
3347 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertex(" << x << ", " << y << ", " << z
3350 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom(" << theVertexEntry << ")";
3352 } catch (const std::invalid_argument& ex) {
3354 } catch (const std::exception& ex) {
3355 std::cout << "Exception: " << ex.what() << std::endl;
3356 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3361 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry)
3366 this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
3367 SMESH::TPythonDump() << _this() << ".RemoveEnforcedVertices()";
3368 } catch (const std::invalid_argument& ex) {
3370 } catch (const std::exception& ex) {
3371 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3377 //=============================================================================
3379 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
3383 //=============================================================================
3384 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue)
3387 this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
3388 std::string theValueStr = theValue ? "True" : "False";
3389 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
3392 //=============================================================================
3394 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
3398 //=============================================================================
3399 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces()
3402 return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
3405 //=============================================================================
3407 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
3411 //=============================================================================
3412 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName)
3415 this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
3416 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
3419 //=============================================================================
3421 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
3425 //=============================================================================
3426 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup()
3429 return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
3433 * Enable internal enforced vertices on specific face if requested by user
3435 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
3438 SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
3439 } catch (SALOME_Exception& ex) {
3440 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3444 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3446 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
3447 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
3450 string theFaceEntry = theFace->GetStudyEntry();
3452 if (theFaceEntry.empty()) {
3453 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
3454 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3456 if (theFace->GetShapeType() == GEOM::FACE)
3458 if (theFace->GetShapeType() == GEOM::COMPOUND)
3459 aName = "Compound_";
3460 aName += theFace->GetEntry();
3461 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
3462 if (!theSFace->_is_nil())
3463 theFaceEntry = theSFace->GetID();
3465 if (theFaceEntry.empty())
3466 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3469 SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
3470 } catch (SALOME_Exception& ex) {
3471 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3475 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3479 this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
3480 std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
3481 if (string(theGroupName).empty())
3482 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
3484 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
3485 } catch (const std::exception& ex) {
3486 std::cout << "Exception: " << ex.what() << std::endl;
3487 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3494 char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
3499 return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
3501 catch (const std::invalid_argument& ex) {
3502 SALOME::ExceptionStruct ExDescription;
3503 ExDescription.text = ex.what();
3504 ExDescription.type = SALOME::BAD_PARAM;
3505 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
3506 ExDescription.lineNumber = 1146;
3507 throw SALOME::SALOME_Exception(ExDescription);
3509 catch (SALOME_Exception& ex) {
3510 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3516 void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
3520 this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
3522 catch (const std::invalid_argument& ex) {
3523 SALOME::ExceptionStruct ExDescription;
3524 ExDescription.text = ex.what();
3525 ExDescription.type = SALOME::BAD_PARAM;
3526 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
3527 ExDescription.lineNumber = 1170;
3528 throw SALOME::SALOME_Exception(ExDescription);
3530 catch (SALOME_Exception& ex) {
3531 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3534 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
3535 << x << ", " << y << ", " << z << ", '" << groupName << "' )";
3539 ///////////////////////
3541 ///////////////////////
3543 ///////////////////////
3546 std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
3548 std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
3549 MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
3550 MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
3551 MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID");
3552 MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL");
3553 MapShapeTypeToString[GEOM::FACE] = std::string("FACE");
3554 MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE");
3555 MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE");
3556 MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX");
3557 MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE");
3558 std::string txtShapeType = MapShapeTypeToString[theShapeType];
3559 return txtShapeType;
3562 void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes)
3564 // Check shape types
3566 std::stringstream typesTxt;
3567 for (std::size_t i=0; i<theShapeTypes.size(); i++)
3569 GEOM::shape_type theShapeType = theShapeTypes[i];
3570 if (shape->GetShapeType() == theShapeType)
3572 typesTxt << ShapeTypeToString(theShapeType);
3573 if (i < theShapeTypes.size()-1 )
3577 std::stringstream msg;
3578 msg << "shape type is not in" << typesTxt.str();
3579 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3583 void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType)
3586 if (shape->GetShapeType() != theShapeType) {
3587 std::stringstream msg;
3588 msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
3589 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3593 std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix)
3595 // Check shape is published in the object browser
3596 string shapeEntry = shape->GetStudyEntry();
3598 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( shape );
3601 // Publish shape if needed
3602 if (shapeEntry.empty()) {
3603 if (shape->GetShapeType() == theShapeType)
3605 aName += shape->GetEntry();
3606 SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(NULL, shape, aName.c_str());
3607 if (!theSFace1->_is_nil())
3608 shapeEntry = theSFace1->GetID();
3610 if (shapeEntry.empty())
3611 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3615 // Format the output of two vectors to use it in MESSAGE and PythonDump
3616 std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
3618 std::stringstream listEntriesTxt;
3620 if (!theSourceVerticesEntries.empty())
3622 listEntriesTxt << ", [" ;
3624 for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
3627 listEntriesTxt << ", ";
3628 listEntriesTxt << *it;
3631 listEntriesTxt << "], [" ;
3633 for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
3636 listEntriesTxt << ", ";
3637 listEntriesTxt << *it;
3639 listEntriesTxt << "]" ;
3641 return listEntriesTxt.str();
3645 * Erase all PreCad periodicity associations
3647 void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
3649 this->GetImpl()->ClearPreCadPeriodicityVectors();
3650 SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
3653 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
3655 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3656 this->GetImpl()->_GetPreCadFacesPeriodicityVector();
3658 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3660 return periodicityList._retn();
3663 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
3665 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3666 this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
3668 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3670 return periodicityList._retn();
3673 // convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
3674 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
3676 BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
3678 periodicityList->length(preCadPeriodicityVector.size());
3680 for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
3682 ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
3684 BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
3685 myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
3686 myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
3688 BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
3689 if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
3691 sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
3692 for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
3693 sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
3696 myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
3698 BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
3699 if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
3701 targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
3702 for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
3703 targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
3706 myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
3708 periodicityList[i] = myPreCadPeriodicity;
3712 return periodicityList._retn();
3716 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
3719 const GEOM::ListOfGO theSourceVertices;
3720 const GEOM::ListOfGO theTargetVertices;
3721 AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices);
3725 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
3726 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3730 size_t theLength = theSourceVertices.length();
3731 if (theLength != theTargetVertices.length())
3732 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3734 std::vector<GEOM::shape_type> allowedShapeTypes;
3735 allowedShapeTypes.push_back(GEOM::FACE);
3736 allowedShapeTypes.push_back(GEOM::COMPOUND);
3738 string prefix1 = "Source_face_";
3739 CheckShapeTypes(theFace1, allowedShapeTypes);
3740 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
3742 string prefix2 = "Target_face_";
3743 CheckShapeTypes(theFace2, allowedShapeTypes);
3744 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
3746 string prefix3 = "Source_vertex_";
3747 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3748 theSourceVerticesEntries->length(theLength);
3749 GEOM::GEOM_Object_ptr theVtx_i;
3751 for (size_t ind = 0; ind < theLength; ind++) {
3752 theVtx_i = theSourceVertices[ind];
3753 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3754 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3757 string prefix4 = "Target_vertex_";
3758 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3759 theTargetVerticesEntries->length(theLength);
3760 for (size_t ind = 0; ind < theLength; ind++) {
3761 theVtx_i = theTargetVertices[ind];
3762 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3763 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3766 string theFace2Name = theFace2->GetName();
3768 AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
3769 theSourceVerticesEntries, theTargetVerticesEntries);
3770 } catch (SALOME_Exception& ex) {
3771 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3776 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
3777 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3781 // Convert BLSURFPlugin::TEntryList to vector<string>
3782 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3783 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3784 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3785 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3788 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3791 this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
3792 theSourceVerticesEntries, theTargetVerticesEntries);
3794 SMESH::TPythonDump pd;
3795 if (!theSourceVerticesEntries.empty())
3797 pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
3798 pd << listEntriesTxt.c_str();
3802 pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
3805 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
3808 const GEOM::ListOfGO theSourceVertices;
3809 const GEOM::ListOfGO theTargetVertices;
3810 AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices);
3813 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
3814 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3818 size_t theLength = theSourceVertices.length();
3819 if (theLength != theTargetVertices.length())
3820 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3822 std::vector<GEOM::shape_type> allowedShapeTypes;
3823 allowedShapeTypes.push_back(GEOM::EDGE);
3824 allowedShapeTypes.push_back(GEOM::COMPOUND);
3826 string prefix1 = "Source_edge_";
3827 CheckShapeTypes(theEdge1, allowedShapeTypes);
3828 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1);
3830 string prefix2 = "Target_edge_";
3831 CheckShapeTypes(theEdge2, allowedShapeTypes);
3832 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
3834 string prefix3 = "Source_vertex_";
3835 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3836 theSourceVerticesEntries->length(theLength);
3837 GEOM::GEOM_Object_ptr theVtx_i;
3839 for (size_t ind = 0; ind < theLength; ind++) {
3840 theVtx_i = theSourceVertices[ind];
3841 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3842 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3845 string prefix4 = "Target_vertex_";
3846 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3847 theTargetVerticesEntries->length(theLength);
3848 for (size_t ind = 0; ind < theLength; ind++) {
3849 theVtx_i = theTargetVertices[ind];
3850 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3851 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3854 string theEdge2Name = theEdge2->GetName();
3856 AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
3857 theSourceVerticesEntries, theTargetVerticesEntries);
3858 } catch (SALOME_Exception& ex) {
3859 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3864 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
3865 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3870 // Convert BLSURFPlugin::TEntryList to vector<string>
3871 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3872 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3873 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3874 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3877 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3879 this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
3880 theSourceVerticesEntries, theTargetVerticesEntries);
3882 SMESH::TPythonDump pd;
3883 if (!theSourceVerticesEntries.empty())
3885 pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
3886 pd << listEntriesTxt.c_str();
3890 pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
3895 //================================================================================
3897 * \brief Sets the file for export resulting mesh in GMF format
3898 * \param theFileName - full name of the file (.mesh, .meshb)
3900 * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
3902 //================================================================================
3903 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
3904 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
3906 bool valueChanged/*, modeChanged*/ = false;
3908 valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
3909 // modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
3910 if (valueChanged)// or (!valueChanged && modeChanged))
3911 this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
3912 } catch (const std::exception& ex) {
3913 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3915 if (valueChanged)// or (!valueChanged && modeChanged))
3916 SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
3919 //================================================================================
3921 * \brief Gets the file name for export resulting mesh in GMF format
3922 * \retval char* - The file name
3924 * Returns the GMF file name
3926 //================================================================================
3927 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
3929 return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
3932 // //================================================================================
3934 // * \brief Gets the file mode for export resulting mesh in GMF format
3935 // * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
3937 // * Returns the GMF file mode
3939 // //================================================================================
3940 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
3941 // ASSERT(myBaseImpl);
3942 // return this->GetImpl()->GetGMFFileMode();
3945 //=============================================================================
3947 * BLSURFPlugin_Hypothesis_i::GetImpl
3949 * Get implementation
3951 //=============================================================================
3952 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
3953 return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
3956 //================================================================================
3958 * \brief Verify whether hypothesis supports given entity type
3959 * \param type - dimension (see SMESH::Dimension enumeration)
3960 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
3962 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
3964 //================================================================================
3965 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
3966 return type == SMESH::DIM_2D;
3970 //================================================================================
3972 * \brief Return geometry this hypothesis depends on. Return false if there is no geometry parameter
3974 //================================================================================
3977 BLSURFPlugin_Hypothesis_i::getObjectsDependOn( std::vector< std::string > & entryArray,
3978 std::vector< int > & subIDArray ) const
3980 typedef ::BLSURFPlugin_Hypothesis BH;
3981 const BH* impl = static_cast<const BH*>( myBaseImpl );
3984 const BH::TSizeMap& sizeMap = impl->_GetSizeMapEntries();
3985 BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
3986 for ( ; entry2size != sizeMap.cend(); ++entry2size )
3987 entryArray.push_back( entry2size->first );
3990 const BH::TSizeMap& sizeMap = impl->_GetAttractorEntries();
3991 BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
3992 for ( ; entry2size != sizeMap.cend(); ++entry2size )
3993 entryArray.push_back( entry2size->first );
3996 const BH::TAttractorMap& classAttractors = impl-> _GetClassAttractorEntries();
3997 BH::TAttractorMap::const_iterator entry2size = classAttractors.cbegin();
3998 for ( ; entry2size != classAttractors.cend(); ++entry2size )
3999 entryArray.push_back( entry2size->first );
4002 const BH::TFaceEntryEnfVertexListMap& faceEntryEnfVertexListMap = impl->_GetAllEnforcedVerticesByFace();
4003 BH::TFaceEntryEnfVertexListMap::const_iterator entry2evList = faceEntryEnfVertexListMap.cbegin();
4004 for ( ; entry2evList != faceEntryEnfVertexListMap.cend(); ++entry2evList )
4006 entryArray.push_back( entry2evList->first );
4008 const BH::TEnfVertexList& evList = entry2evList->second;
4009 BH::TEnfVertexList::const_iterator evIt = evList.cbegin();
4010 for ( ; evIt != evList.cend(); ++evIt )
4012 const BH::TEnfVertex* ev = *evIt;
4013 entryArray.push_back( ev->geomEntry );
4014 entryArray.insert( entryArray.end(), ev->faceEntries.cbegin(), ev->faceEntries.cend() );
4018 // { // duplicated data of faceEntryEnfVertexListMap
4019 // const BH::TEnfVertexList& enfVertexList = impl->_GetAllEnforcedVertices();
4020 // const BH::TFaceEntryCoordsListMap& faceEntryCoordsListMap = impl->_GetAllCoordsByFace();
4021 // const BH::TFaceEntryEnfVertexEntryListMap& faceEntryEnfVertexEntryListMap = impl->_GetAllEnfV // const BH::TEnfVertexEntryEnfVertexMap& enfVertexEntryEnfVertexMap = impl->_GetAllEnforcedVert // }
4023 const BH::TPreCadPeriodicityVector& preCadFacesPeriodicityVector = impl->_GetPreCadFacesPeriodicityVector();
4024 BH::TPreCadPeriodicityVector::const_iterator pcp = preCadFacesPeriodicityVector.cbegin();
4025 for ( ; pcp != preCadFacesPeriodicityVector.cend(); ++pcp )
4027 entryArray.push_back( pcp->shape1Entry );
4028 entryArray.push_back( pcp->shape2Entry );
4029 entryArray.insert( entryArray.end(),
4030 pcp->theSourceVerticesEntries.cbegin(),
4031 pcp->theSourceVerticesEntries.cend() );
4032 entryArray.insert( entryArray.end(),
4033 pcp->theTargetVerticesEntries.cbegin(),
4034 pcp->theTargetVerticesEntries.cend() );
4038 const BH::TPreCadPeriodicityVector& preCadEdgesPeriodicityVector = impl->_GetPreCadEdgesPeriodicityVector();
4039 BH::TPreCadPeriodicityVector::const_iterator pcp = preCadEdgesPeriodicityVector.cbegin();
4040 for ( ; pcp != preCadEdgesPeriodicityVector.cend(); ++pcp )
4042 entryArray.push_back( pcp->shape1Entry );
4043 entryArray.push_back( pcp->shape2Entry );
4044 entryArray.insert( entryArray.end(),
4045 pcp->theSourceVerticesEntries.cbegin(),
4046 pcp->theSourceVerticesEntries.cend() );
4047 entryArray.insert( entryArray.end(),
4048 pcp->theTargetVerticesEntries.cbegin(),
4049 pcp->theTargetVerticesEntries.cend() );
4053 const BH::THyperPatchList& hyperPatchList = impl->GetHyperPatches();
4054 BH::THyperPatchList::const_iterator idSet = hyperPatchList.cbegin();
4055 for ( ; idSet != hyperPatchList.cend(); ++idSet )
4057 subIDArray.insert( subIDArray.end(), idSet->cbegin(), idSet->cend() );
4063 //================================================================================
4065 * \brief Set new geometry instead of that returned by getObjectsDependOn()
4067 //================================================================================
4070 BLSURFPlugin_Hypothesis_i::setObjectsDependOn( std::vector< std::string > & entryArray,
4071 std::vector< int > & subIDArray )
4073 typedef ::BLSURFPlugin_Hypothesis BH;
4074 BH* impl = static_cast<BH*>( myBaseImpl );
4078 BH::TSizeMap& sizeMapNew = const_cast< BH::TSizeMap& >( impl->_GetSizeMapEntries() );
4079 BH::TSizeMap sizeMap;
4080 sizeMap.swap( sizeMapNew );
4081 BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
4082 for ( ; entry2size != sizeMap.cend(); ++entry2size, ++iEnt )
4083 if ( entryArray[ iEnt ].empty() == entry2size->first.empty() )
4084 sizeMapNew[ entryArray[ iEnt ]] = entry2size->second;
4087 BH::TSizeMap& sizeMapNew = const_cast< BH::TSizeMap& >( impl->_GetAttractorEntries() );
4088 BH::TSizeMap sizeMap;
4089 sizeMap.swap( sizeMapNew );
4090 BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
4091 for ( ; entry2size != sizeMap.cend(); ++entry2size, ++iEnt )
4092 if ( entryArray[ iEnt ].empty() == entry2size->first.empty() )
4093 sizeMapNew[ entryArray[ iEnt ]] = entry2size->second;
4096 BH::TAttractorMap& attrMapNew =
4097 const_cast< BH::TAttractorMap& > ( impl->_GetClassAttractorEntries() );
4098 BH::TAttractorMap attrMap;
4099 attrMap.swap( attrMapNew );
4100 BH::TAttractorMap::const_iterator entry2size = attrMap.cbegin();
4101 for ( ; entry2size != attrMap.cend(); ++entry2size, ++iEnt )
4102 if ( entryArray[ iEnt ].empty() == entry2size->first.empty() )
4103 attrMapNew.insert( std::make_pair( entryArray[ iEnt ], entry2size->second ));
4105 delete entry2size->second;
4108 BH::TFaceEntryEnfVertexListMap& faceEntryEnfVertexListMapNew =
4109 const_cast< BH::TFaceEntryEnfVertexListMap& >( impl->_GetAllEnforcedVerticesByFace() );
4110 BH::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap;
4111 faceEntryEnfVertexListMap.swap( faceEntryEnfVertexListMapNew );
4113 BH::TEnfVertexList& enfVertexList =
4114 const_cast< BH::TEnfVertexList& > ( impl->_GetAllEnforcedVertices() );
4115 enfVertexList.clear(); // avoid removal
4117 impl->ClearAllEnforcedVertices();
4119 BH::TFaceEntryEnfVertexListMap::iterator entry2evList = faceEntryEnfVertexListMap.begin();
4120 for ( ; entry2evList != faceEntryEnfVertexListMap.end(); ++entry2evList )
4122 const BH::TEntry& entry = entryArray[ iEnt++ ];
4123 bool faceOk = ( entry.empty() == entry2evList->first.empty() );
4125 BH::TEnfVertexList& evList = entry2evList->second;
4126 BH::TEnfVertexList::iterator evIt = evList.begin();
4127 for ( ; evIt != evList.end(); ++evIt )
4129 BH::TEnfVertex* ev = *evIt;
4130 bool ok = faceOk && ( ev->geomEntry.empty() != entryArray[ iEnt ].empty() );
4131 ev->geomEntry = entryArray[ iEnt++ ];
4132 BH::TEntryList faceEntriesNew;
4133 BH::TEntryList::iterator fEnt = ev->faceEntries.begin();
4134 for ( ; fEnt != ev->faceEntries.end(); ++fEnt, ++iEnt )
4136 if ( !entryArray[ iEnt ].empty() )
4137 faceEntriesNew.insert( entryArray[ iEnt ]);
4141 ev->faceEntries.swap( faceEntriesNew );
4142 impl->AddEnforcedVertex( entry, ev );
4152 BH::TPreCadPeriodicityVector& preCadPeriodicityVector =
4153 const_cast< BH::TPreCadPeriodicityVector&> ( impl->_GetPreCadFacesPeriodicityVector() );
4154 BH::TPreCadPeriodicityVector::iterator pcp = preCadPeriodicityVector.begin();
4155 for ( ; pcp != preCadPeriodicityVector.end(); ++pcp )
4157 pcp->shape1Entry = entryArray[ iEnt++ ];
4158 pcp->shape2Entry = entryArray[ iEnt++ ];
4159 for ( size_t i = 0; i < pcp->theSourceVerticesEntries.size(); ++i, iEnt++ )
4160 pcp->theSourceVerticesEntries[i] = entryArray[ iEnt ];
4162 for ( size_t i = 0; i < pcp->theTargetVerticesEntries.size(); ++i, iEnt++ )
4163 pcp->theTargetVerticesEntries[i] = entryArray[ iEnt ];
4167 BH::TPreCadPeriodicityVector& preCadPeriodicityVector =
4168 const_cast< BH::TPreCadPeriodicityVector&> ( impl->_GetPreCadEdgesPeriodicityVector() );
4169 BH::TPreCadPeriodicityVector::iterator pcp = preCadPeriodicityVector.begin();
4170 for ( ; pcp != preCadPeriodicityVector.end(); ++pcp )
4172 pcp->shape1Entry = entryArray[ iEnt++ ];
4173 pcp->shape2Entry = entryArray[ iEnt++ ];
4174 for ( size_t i = 0; i < pcp->theSourceVerticesEntries.size(); ++i, iEnt++ )
4175 pcp->theSourceVerticesEntries[i] = entryArray[ iEnt ];
4177 for ( size_t i = 0; i < pcp->theTargetVerticesEntries.size(); ++i, iEnt++ )
4178 pcp->theTargetVerticesEntries[i] = entryArray[ iEnt ];
4184 BH::THyperPatchList& hyperPatchListNew =
4185 const_cast< BH::THyperPatchList& >( impl->GetHyperPatches() );
4186 BH::THyperPatchList hyperPatchList;
4187 hyperPatchList.swap( hyperPatchListNew );
4188 BH::THyperPatchList::iterator idSet = hyperPatchList.begin();
4189 for ( ; idSet != hyperPatchList.end(); ++idSet )
4191 BH::THyperPatchTags& ids = *idSet;
4192 BH::THyperPatchTags idsNew;
4193 BH::THyperPatchTags::iterator i = ids.begin();
4194 for ( ; i != ids.end(); ++i, ++iID )
4195 if ( subIDArray[ iID ] > 0 )
4196 idsNew.insert( subIDArray[ iID ]);
4197 if ( !idsNew.empty() )
4198 hyperPatchListNew.push_back( idsNew );
4202 return ( iEnt == entryArray.size() && iID == subIDArray.size() );