X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FBLSURFPlugin%2FBLSURFPlugin_Hypothesis_i.cxx;h=beaddc1b30b9a60713a33f5d78db4ff812e72d7d;hb=8422810dcc5e588762f906db7a15f31eb337f3eb;hp=0190ed06f12ed1c567e78e45df96b806bd3a04f8;hpb=c701e968eb75a1e2b284915bab159efffc1e3c0c;p=plugins%2Fblsurfplugin.git diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx index 0190ed0..beaddc1 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D +// Copyright (C) 2007-2015 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,17 +24,18 @@ // --- // #include "BLSURFPlugin_Hypothesis_i.hxx" -#include "SMESH_Gen.hxx" -#include "SMESH_Gen_i.hxx" -#include "SMESH_PythonDump.hxx" -#include "GEOM_Object.hxx" -#include "Utils_CorbaException.hxx" -#include "utilities.h" +#include +#include +#include + +#include +#include +#include #include #include -#include "boost/regex.hpp" +#include //============================================================================= /*! @@ -61,61 +62,62 @@ BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i() { MESSAGE( "BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i" ); } +//============================================================================= + +//============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::SetTopology + * BLSURFPlugin_Hypothesis_i::SetPhysicalMesh * - * Set topology + * Set PhysicalMesh */ //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetTopology(CORBA::Long theValue) { - // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTopology"); +void BLSURFPlugin_Hypothesis_i::SetPhysicalMesh(CORBA::Long theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhysicalMesh"); ASSERT(myBaseImpl); - this->GetImpl()->SetTopology((::BLSURFPlugin_Hypothesis::Topology) theValue); - SMESH::TPythonDump() << _this() << ".SetTopology( " << theValue << " )"; + this->GetImpl()->SetPhysicalMesh((::BLSURFPlugin_Hypothesis::PhysicalMesh) theValue); + SMESH::TPythonDump() << _this() << ".SetPhysicalMesh( " << theValue << " )"; } //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::GetTopology + * BLSURFPlugin_Hypothesis_i::GetPhysicalMesh * - * Get Topology + * Get PhysicalMesh */ //============================================================================= -CORBA::Long BLSURFPlugin_Hypothesis_i::GetTopology() { - // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTopology"); +CORBA::Long BLSURFPlugin_Hypothesis_i::GetPhysicalMesh() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhysicalMesh"); ASSERT(myBaseImpl); - return this->GetImpl()->GetTopology(); + return this->GetImpl()->GetPhysicalMesh(); } -//============================================================================= - //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::SetPhysicalMesh + * BLSURFPlugin_Hypothesis_i::SetGeometricMesh * - * Set PhysicalMesh + * Set GeometricMesh */ //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetPhysicalMesh(CORBA::Long theValue) { - // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhysicalMesh"); +void BLSURFPlugin_Hypothesis_i::SetGeometricMesh(CORBA::Long theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGeometricMesh"); ASSERT(myBaseImpl); - this->GetImpl()->SetPhysicalMesh((::BLSURFPlugin_Hypothesis::PhysicalMesh) theValue); - SMESH::TPythonDump() << _this() << ".SetPhysicalMesh( " << theValue << " )"; + this->GetImpl()->SetGeometricMesh((::BLSURFPlugin_Hypothesis::GeometricMesh) theValue); + SMESH::TPythonDump() << _this() << ".SetGeometricMesh( " << theValue << " )"; } //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::GetPhysicalMesh + * BLSURFPlugin_Hypothesis_i::GetGeometricMesh * - * Get PhysicalMesh + * Get GeometricMesh */ //============================================================================= -CORBA::Long BLSURFPlugin_Hypothesis_i::GetPhysicalMesh() { - // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhysicalMesh"); +CORBA::Long BLSURFPlugin_Hypothesis_i::GetGeometricMesh() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGeometricMesh"); ASSERT(myBaseImpl); - return this->GetImpl()->GetPhysicalMesh(); + return this->GetImpl()->GetGeometricMesh(); } //============================================================================= @@ -128,10 +130,24 @@ CORBA::Long BLSURFPlugin_Hypothesis_i::GetPhysicalMesh() { void BLSURFPlugin_Hypothesis_i::SetPhySize(CORBA::Double theValue) { // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySize"); ASSERT(myBaseImpl); - this->GetImpl()->SetPhySize(theValue); + this->GetImpl()->SetPhySize(theValue, false); SMESH::TPythonDump() << _this() << ".SetPhySize( " << theValue << " )"; } +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::SetPhySizeRel + * + * Set Relative PhySize + */ +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetPhySizeRel(CORBA::Double theValue) { +// MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySizeRel"); + ASSERT(myBaseImpl); + this->GetImpl()->SetPhySize(theValue, true); + SMESH::TPythonDump() << _this() << ".SetPhySizeRel( " << theValue << " )"; +} + //============================================================================= /*! * BLSURFPlugin_Hypothesis_i::GetPhySize @@ -146,214 +162,440 @@ CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhySize() { } //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetPhyMin(CORBA::Double theMinSize) { +/*! + * BLSURFPlugin_Hypothesis_i::IsPhySizeRel + * + * Returns True if PhySize is relative + */ +//============================================================================= +CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsPhySizeRel() { +// MESSAGE("BLSURFPlugin_Hypothesis_i::IsPhySizeRel"); ASSERT(myBaseImpl); - if (GetPhyMin() != theMinSize) { - this->GetImpl()->SetPhyMin(theMinSize); - SMESH::TPythonDump() << _this() << ".SetPhyMin( " << theMinSize << " )"; + return this->GetImpl()->IsPhySizeRel(); +} + +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetMinSize(CORBA::Double theMinSize) { + ASSERT(myBaseImpl); + if (IsMinSizeRel() || GetMinSize() != theMinSize ) { + this->GetImpl()->SetMinSize(theMinSize, false); + SMESH::TPythonDump() << _this() << ".SetMinSize( " << theMinSize << " )"; } } //============================================================================= -CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMin() { +void BLSURFPlugin_Hypothesis_i::SetMinSizeRel(CORBA::Double theMinSize) { ASSERT(myBaseImpl); - return this->GetImpl()->GetPhyMin(); + if ( !IsMinSizeRel() || (GetMinSize() != theMinSize) ) { + this->GetImpl()->SetMinSize(theMinSize, true); + SMESH::TPythonDump() << _this() << ".SetMinSizeRel( " << theMinSize << " )"; + } } //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize) { +CORBA::Double BLSURFPlugin_Hypothesis_i::GetMinSize() { ASSERT(myBaseImpl); - if (GetPhyMax() != theMaxSize) { - this->GetImpl()->SetPhyMax(theMaxSize); - SMESH::TPythonDump() << _this() << ".SetPhyMax( " << theMaxSize << " )"; + return this->GetImpl()->GetMinSize(); +} + +//============================================================================= +CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMinSizeRel() { +// MESSAGE("BLSURFPlugin_Hypothesis_i::IsMinSizeRel"); + ASSERT(myBaseImpl); + return this->GetImpl()->IsMinSizeRel(); +} + +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetMaxSize(CORBA::Double theMaxSize) { + ASSERT(myBaseImpl); + if (IsMaxSizeRel() || GetMaxSize() != theMaxSize) { + this->GetImpl()->SetMaxSize(theMaxSize, false); + SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theMaxSize << " )"; } } //============================================================================= -CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax() { +void BLSURFPlugin_Hypothesis_i::SetMaxSizeRel(CORBA::Double theMaxSize) { ASSERT(myBaseImpl); - return this->GetImpl()->GetPhyMax(); + if ( !IsMaxSizeRel() || (GetMaxSize() != theMaxSize) ) { + this->GetImpl()->SetMaxSize(theMaxSize, true); + SMESH::TPythonDump() << _this() << ".SetMaxSizeRel( " << theMaxSize << " )"; + } +} + +//============================================================================= +CORBA::Double BLSURFPlugin_Hypothesis_i::GetMaxSize() { + ASSERT(myBaseImpl); + return this->GetImpl()->GetMaxSize(); +} + +//============================================================================= +CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMaxSizeRel() { +// MESSAGE("BLSURFPlugin_Hypothesis_i::IsMaxSizeRel"); + ASSERT(myBaseImpl); + return this->GetImpl()->IsMaxSizeRel(); } //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::SetGeometricMesh + * BLSURFPlugin_Hypothesis_i::SetGradation * - * Set GeometricMesh + * Set Gradation */ +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetGradation(CORBA::Double theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGradation"); + ASSERT(myBaseImpl); + this->GetImpl()->SetGradation(theValue); + SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )"; +} //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetGeometricMesh(CORBA::Long theValue) { - // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGeometricMesh"); +/*! + * BLSURFPlugin_Hypothesis_i::GetGradation + * + * Get Gradation + */ +//============================================================================= +CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGradation"); ASSERT(myBaseImpl); - this->GetImpl()->SetGeometricMesh((::BLSURFPlugin_Hypothesis::GeometricMesh) theValue); - SMESH::TPythonDump() << _this() << ".SetGeometricMesh( " << theValue << " )"; + return this->GetImpl()->GetGradation(); } //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::GetGeometricMesh + * BLSURFPlugin_Hypothesis_i::SetQuadAllowed * - * Get GeometricMesh + * Set true or false */ //============================================================================= -CORBA::Long BLSURFPlugin_Hypothesis_i::GetGeometricMesh() { - // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGeometricMesh"); +void BLSURFPlugin_Hypothesis_i::SetQuadAllowed(CORBA::Boolean theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadAllowed"); ASSERT(myBaseImpl); - return this->GetImpl()->GetGeometricMesh(); + this->GetImpl()->SetQuadAllowed(theValue); + std::string theValueStr = theValue ? "True" : "False"; + SMESH::TPythonDump() << _this() << ".SetQuadAllowed( " << theValueStr.c_str() << " )"; } //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::SetAngleMeshS + * BLSURFPlugin_Hypothesis_i::GetQuadAllowed * - * Set AngleMeshS + * Get true or false */ //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetAngleMeshS(CORBA::Double theValue) { - // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAngleMeshS"); +CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadAllowed() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadAllowed"); ASSERT(myBaseImpl); - this->GetImpl()->SetAngleMeshS(theValue); - SMESH::TPythonDump() << _this() << ".SetAngleMeshS( " << theValue << " )"; + return this->GetImpl()->GetQuadAllowed(); } //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::GetAngleMeshS + * BLSURFPlugin_Hypothesis_i::SetAngleMesh * - * Get AngleMeshS + * Set AngleMesh */ //============================================================================= -CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS() { - // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAngleMeshS"); +void BLSURFPlugin_Hypothesis_i::SetAngleMesh(CORBA::Double theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAngleMesh"); ASSERT(myBaseImpl); - return this->GetImpl()->GetAngleMeshS(); + this->GetImpl()->SetAngleMesh(theValue); + SMESH::TPythonDump() << _this() << ".SetAngleMesh( " << theValue << " )"; } //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetAngleMeshC(CORBA::Double angle) { +/*! + * BLSURFPlugin_Hypothesis_i::GetAngleMesh + * + * Get AngleMesh + */ +//============================================================================= +CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMesh() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAngleMesh"); ASSERT(myBaseImpl); - this->GetImpl()->SetAngleMeshC(angle); - SMESH::TPythonDump() << _this() << ".SetAngleMeshC( " << angle << " )"; + return this->GetImpl()->GetAngleMesh(); } //============================================================================= -CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshC() { +/*! + * BLSURFPlugin_Hypothesis_i::SetChordalError + * + * Set Chordal Error + */ +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetChordalError(CORBA::Double theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetChordalError"); ASSERT(myBaseImpl); - return this->GetImpl()->GetAngleMeshC(); + this->GetImpl()->SetChordalError(theValue); + SMESH::TPythonDump() << _this() << ".SetChordalError( " << theValue << " )"; } //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetGeoMin(CORBA::Double theMinSize) { +/*! + * BLSURFPlugin_Hypothesis_i::GetChordalError + * + * Get Chordal Error + */ +//============================================================================= +CORBA::Double BLSURFPlugin_Hypothesis_i::GetChordalError() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetChordalError"); ASSERT(myBaseImpl); - if (GetGeoMin() != theMinSize) { - this->GetImpl()->SetGeoMin(theMinSize); - SMESH::TPythonDump() << _this() << ".SetGeoMin( " << theMinSize << " )"; - } + return this->GetImpl()->GetChordalError(); } //============================================================================= -CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMin() { +/*! + * BLSURFPlugin_Hypothesis_i::SetAnisotropic + * + * Set true or false + */ +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetAnisotropic(CORBA::Boolean theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAnisotropic"); ASSERT(myBaseImpl); - return this->GetImpl()->GetGeoMin(); + this->GetImpl()->SetAnisotropic(theValue); + std::string theValueStr = theValue ? "True" : "False"; + SMESH::TPythonDump() << _this() << ".SetAnisotropic( " << theValueStr.c_str() << " )"; } //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetGeoMax(CORBA::Double theMaxSize) { +/*! + * BLSURFPlugin_Hypothesis_i::GetAnisotropic + * + * Get true or false + */ +//============================================================================= +CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetAnisotropic() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAnisotropic"); ASSERT(myBaseImpl); - if (GetGeoMax() != theMaxSize) { - this->GetImpl()->SetGeoMax(theMaxSize); - SMESH::TPythonDump() << _this() << ".SetGeoMax( " << theMaxSize << " )"; - } + return this->GetImpl()->GetAnisotropic(); } //============================================================================= -CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMax() { +/*! + * BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio + * + * Set Anisotropic Ratio + */ +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio(CORBA::Double theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio"); ASSERT(myBaseImpl); - return this->GetImpl()->GetGeoMax(); + this->GetImpl()->SetAnisotropicRatio(theValue); + SMESH::TPythonDump() << _this() << ".SetAnisotropicRatio( " << theValue << " )"; } //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::SetGradation + * BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio * - * Set Gradation + * Get Anisotropic Ratio */ //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetGradation(CORBA::Double theValue) { - // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGradation"); +CORBA::Double BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio"); ASSERT(myBaseImpl); - this->GetImpl()->SetGradation(theValue); - SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )"; + return this->GetImpl()->GetAnisotropicRatio(); } + //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::GetGradation + * BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges * - * Get Gradation + * Set true or false */ //============================================================================= -CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation() { - // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGradation"); +void BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges(CORBA::Boolean theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges"); ASSERT(myBaseImpl); - return this->GetImpl()->GetGradation(); + this->GetImpl()->SetRemoveTinyEdges(theValue); + std::string theValueStr = theValue ? "True" : "False"; + SMESH::TPythonDump() << _this() << ".SetRemoveTinyEdges( " << theValueStr.c_str() << " )"; } //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::SetQuadAllowed + * BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges + * + * Get true or false + */ +//============================================================================= +CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetRemoveTinyEdges(); +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength + * + * Set Tiny Edge Length + */ +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength(CORBA::Double theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength"); + ASSERT(myBaseImpl); + this->GetImpl()->SetTinyEdgeLength(theValue); + SMESH::TPythonDump() << _this() << ".SetTinyEdgeLength( " << theValue << " )"; +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength + * + * Get Tiny Edge Length + */ +//============================================================================= +CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetTinyEdgeLength(); +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::SetBadElementRemoval * * Set true or false */ //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetQuadAllowed(CORBA::Boolean theValue) { - // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadAllowed"); +void BLSURFPlugin_Hypothesis_i::SetBadElementRemoval(CORBA::Boolean theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetBadElementRemoval"); ASSERT(myBaseImpl); - this->GetImpl()->SetQuadAllowed(theValue); + this->GetImpl()->SetBadElementRemoval(theValue); std::string theValueStr = theValue ? "True" : "False"; - SMESH::TPythonDump() << _this() << ".SetQuadAllowed( " << theValueStr.c_str() << " )"; + SMESH::TPythonDump() << _this() << ".SetBadElementRemoval( " << theValueStr.c_str() << " )"; } //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::GetQuadAllowed + * BLSURFPlugin_Hypothesis_i::GetBadElementRemoval * * Get true or false */ //============================================================================= -CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadAllowed() { - // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadAllowed"); +CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetBadElementRemoval() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetBadElementRemoval"); ASSERT(myBaseImpl); - return this->GetImpl()->GetQuadAllowed(); + return this->GetImpl()->GetBadElementRemoval(); +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio + * + * Set Bad Surface Element Aspect Ratio + */ +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio(CORBA::Double theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio"); + ASSERT(myBaseImpl); + this->GetImpl()->SetBadElementAspectRatio(theValue); + SMESH::TPythonDump() << _this() << ".SetBadElementAspectRatio( " << theValue << " )"; } //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::SetDecimesh + * BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio + * + * Get Bad Surface Element Aspect Ratio + */ +//============================================================================= +CORBA::Double BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetBadElementAspectRatio(); +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::SetOptimizeMesh * * Set true or false */ //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetDecimesh(CORBA::Boolean theValue) { - // MESSAGE("BLSURFPlugin_Hypothesis_i::SetDecimesh"); +void BLSURFPlugin_Hypothesis_i::SetOptimizeMesh(CORBA::Boolean theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetOptimizeMesh"); ASSERT(myBaseImpl); - this->GetImpl()->SetDecimesh(theValue); + this->GetImpl()->SetOptimizeMesh(theValue); std::string theValueStr = theValue ? "True" : "False"; - SMESH::TPythonDump() << _this() << ".SetDecimesh( " << theValueStr.c_str() << " )"; + SMESH::TPythonDump() << _this() << ".SetOptimizeMesh( " << theValueStr.c_str() << " )"; } //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::GetDecimesh + * BLSURFPlugin_Hypothesis_i::GetOptimizeMesh * * Get true or false */ //============================================================================= -CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() { - // MESSAGE("BLSURFPlugin_Hypothesis_i::GetDecimesh"); +CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimizeMesh() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetOptimizeMesh"); ASSERT(myBaseImpl); - return this->GetImpl()->GetDecimesh(); + return this->GetImpl()->GetOptimizeMesh(); +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::SetQuadraticMesh + * + * Set true or false + */ +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetQuadraticMesh(CORBA::Boolean theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadraticMesh"); + ASSERT(myBaseImpl); + this->GetImpl()->SetQuadraticMesh(theValue); + std::string theValueStr = theValue ? "True" : "False"; + SMESH::TPythonDump() << _this() << ".SetQuadraticMesh( " << theValueStr.c_str() << " )"; +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::GetQuadraticMesh + * + * Get true or false + */ +//============================================================================= +CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadraticMesh() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadraticMesh"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetQuadraticMesh(); +} + + + + + +/*! + * BLSURFPlugin_Hypothesis_i::SetTopology + * + * Set topology + */ + +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetTopology(CORBA::Long theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTopology"); + ASSERT(myBaseImpl); + this->GetImpl()->SetTopology((::BLSURFPlugin_Hypothesis::Topology) theValue); + SMESH::TPythonDump() << _this() << ".SetTopology( " << theValue << " )"; +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::GetTopology + * + * Get Topology + */ +//============================================================================= +CORBA::Long BLSURFPlugin_Hypothesis_i::GetTopology() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTopology"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetTopology(); } //============================================================================= @@ -402,30 +644,30 @@ CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges() { //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges + * BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology * * Set true or false */ //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) { - // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges"); +void BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology(CORBA::Boolean theValue) { + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology"); ASSERT(myBaseImpl); - this->GetImpl()->SetPreCADRemoveNanoEdges(theValue); + this->GetImpl()->SetPreCADProcess3DTopology(theValue); std::string theValueStr = theValue ? "True" : "False"; - SMESH::TPythonDump() << _this() << ".SetPreCADRemoveNanoEdges( " << theValueStr.c_str() << " )"; + SMESH::TPythonDump() << _this() << ".SetPreCADProcess3DTopology( " << theValueStr.c_str() << " )"; } //============================================================================= /*! - * BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges + * BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology * * Get true or false */ //============================================================================= -CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() { - // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges"); +CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology() { + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology"); ASSERT(myBaseImpl); - return this->GetImpl()->GetPreCADRemoveNanoEdges(); + return this->GetImpl()->GetPreCADProcess3DTopology(); } //============================================================================= @@ -456,32 +698,6 @@ CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput() { return this->GetImpl()->GetPreCADDiscardInput(); } -//============================================================================= -/*! - * BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano - * - * Set length for nano edges - */ -//============================================================================= -void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) { - // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano"); - ASSERT(myBaseImpl); - this->GetImpl()->SetPreCADEpsNano(theValue); - SMESH::TPythonDump() << _this() << ".SetPreCADEpsNano( " << theValue << " )"; -} - -//============================================================================= -/*! - * BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano - * - * Get length of nano edges - */ -//============================================================================= -CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() { - // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano"); - ASSERT(myBaseImpl); - return this->GetImpl()->GetPreCADEpsNano(); -} //============================================================================= @@ -592,16 +808,30 @@ BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() { BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array(); const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues(); - result->length(opts.size()); + const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues(); + result->length(opts.size()+custom_opts.size()); + int i=0; ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin(); - for (int i = 0; opIt != opts.end(); ++opIt, ++i) { - string name_value = opIt->first; + for (; opIt != opts.end(); ++opIt, ++i) { + string name_value_type = opIt->first; + if (!opIt->second.empty()) { + name_value_type += ":"; + name_value_type += opIt->second; + name_value_type += ":0"; + } + result[i] = CORBA::string_dup(name_value_type.c_str()); + } + + opIt = custom_opts.begin(); + for (; opIt != custom_opts.end(); ++opIt,++i) { + string name_value_type = opIt->first; if (!opIt->second.empty()) { - name_value += ":"; - name_value += opIt->second; + name_value_type += ":"; + name_value_type += opIt->second; + name_value_type += ":1"; } - result[i] = CORBA::string_dup(name_value.c_str()); + result[i] = CORBA::string_dup(name_value_type.c_str()); } return result._retn(); } @@ -613,16 +843,30 @@ BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() { BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array(); const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues(); - result->length(opts.size()); + const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomPreCADOptionValues(); + result->length(opts.size()+custom_opts.size()); + int i=0; ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin(); - for (int i = 0; opIt != opts.end(); ++opIt, ++i) { - string name_value = opIt->first; + for (; opIt != opts.end(); ++opIt, ++i) { + string name_value_type = opIt->first; + if (!opIt->second.empty()) { + name_value_type += ":"; + name_value_type += opIt->second; + name_value_type += ":0"; + } + result[i] = CORBA::string_dup(name_value_type.c_str()); + } + + opIt = custom_opts.begin(); + for (; opIt != custom_opts.end(); ++opIt,++i) { + string name_value_type = opIt->first; if (!opIt->second.empty()) { - name_value += ":"; - name_value += opIt->second; + name_value_type += ":"; + name_value_type += opIt->second; + name_value_type += ":1"; } - result[i] = CORBA::string_dup(name_value.c_str()); + result[i] = CORBA::string_dup(name_value_type.c_str()); } return result._retn(); } @@ -633,17 +877,25 @@ void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array throw (SALOME::SALOME_Exception) { ASSERT(myBaseImpl); for (int i = 0; i < options.length(); ++i) { - string name_value = options[i].in(); - int colonPos = name_value.find(':'); + string name_value_type = options[i].in(); + if(name_value_type.empty()) + continue; + int colonPos = name_value_type.find(':'); string name, value; + bool custom = false; if (colonPos == string::npos) // ':' not found - name = name_value; + name = name_value_type; else { - name = name_value.substr(0, colonPos); - if (colonPos < name_value.size() - 1 && name_value[colonPos] != ' ') - value = name_value.substr(colonPos + 1); + name = name_value_type.substr(0, colonPos); + if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') { + string value_type = name_value_type.substr(colonPos + 1); + colonPos = value_type.find(':'); + value = value_type.substr(0, colonPos); + if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ') + custom = atoi((value_type.substr(colonPos + 1)).c_str()); + } } - SetOptionValue(name.c_str(), value.c_str()); + custom ? AddOption(name.c_str(), value.c_str()) : SetOptionValue(name.c_str(), value.c_str()); } } @@ -653,26 +905,76 @@ void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string throw (SALOME::SALOME_Exception) { ASSERT(myBaseImpl); for (int i = 0; i < options.length(); ++i) { - string name_value = options[i].in(); - int colonPos = name_value.find(':'); + string name_value_type = options[i].in(); + if(name_value_type.empty()) + continue; + int colonPos = name_value_type.find(':'); string name, value; + bool custom = false; if (colonPos == string::npos) // ':' not found - name = name_value; + name = name_value_type; else { - name = name_value.substr(0, colonPos); - if (colonPos < name_value.size() - 1 && name_value[colonPos] != ' ') - value = name_value.substr(colonPos + 1); + name = name_value_type.substr(0, colonPos); + if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') { + string value_type = name_value_type.substr(colonPos + 1); + colonPos = value_type.find(':'); + value = value_type.substr(0, colonPos); + if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ') + custom = atoi((value_type.substr(colonPos + 1)).c_str()); + } } - SetPreCADOptionValue(name.c_str(), value.c_str()); + custom ? AddPreCADOption(name.c_str(), value.c_str()) : SetPreCADOptionValue(name.c_str(), value.c_str()); + } +} + +//============================================================================= + +void BLSURFPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue) +{ + ASSERT(myBaseImpl); + bool valueChanged = (this->GetImpl()->GetOption(optionName) != optionValue); + if (valueChanged) { + this->GetImpl()->AddOption(optionName, optionValue); + SMESH::TPythonDump() << _this() << ".AddOption( '" << optionName << "', '" << optionValue << "' )"; + } +} + +//============================================================================= + +void BLSURFPlugin_Hypothesis_i::AddPreCADOption(const char* optionName, const char* optionValue) +{ + ASSERT(myBaseImpl); + bool valueChanged = (this->GetImpl()->GetPreCADOption(optionName) != optionValue); + if (valueChanged) { + this->GetImpl()->AddPreCADOption(optionName, optionValue); + SMESH::TPythonDump() << _this() << ".AddPreCADOption( '" << optionName << "', '" << optionValue << "' )"; } } //============================================================================= +char* BLSURFPlugin_Hypothesis_i::GetOption(const char* optionName) +{ + ASSERT(myBaseImpl); + return CORBA::string_dup(this->GetImpl()->GetOption(optionName).c_str()); +} + +//============================================================================= + +char* BLSURFPlugin_Hypothesis_i::GetPreCADOption(const char* optionName) +{ + ASSERT(myBaseImpl); + return CORBA::string_dup(this->GetImpl()->GetPreCADOption(optionName).c_str()); +} + +//============================================================================= + void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap) throw (SALOME::SALOME_Exception) { ASSERT(myBaseImpl); MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry); + if ( !entry || !entry[0] ) + THROW_SALOME_CORBA_EXCEPTION( "SetSizeMapEntry(): empty geom entry", SALOME::BAD_PARAM ); bool valueChanged = false; try { valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap); @@ -695,6 +997,38 @@ void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* s //============================================================================= +void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap) + throw (SALOME::SALOME_Exception) { + ASSERT(myBaseImpl); + MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry); + bool valueChanged = false; + std::ostringstream sizeMapFunction; + switch (shapeType) { + case GEOM::FACE: sizeMapFunction << "def f(u,v): return " << sizeMap ; break; + case GEOM::EDGE: sizeMapFunction << "def f(t): return " << sizeMap ; break; + case GEOM::VERTEX: sizeMapFunction << "def f(): return " << sizeMap ; break; + } + try { + valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str()); + if (valueChanged) + this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str()); + } catch (const std::invalid_argument& ex) { + SALOME::ExceptionStruct ExDescription; + ExDescription.text = ex.what(); + ExDescription.type = SALOME::BAD_PARAM; + ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)"; + ExDescription.lineNumber = 0; + throw SALOME::SALOME_Exception(ExDescription); + } catch (SALOME_Exception& ex) { + THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM ); + } + MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry); + if (valueChanged) + SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", '" << sizeMap << "' )"; +} + +//============================================================================= + void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor) throw (SALOME::SALOME_Exception) { ASSERT(myBaseImpl); @@ -725,7 +1059,7 @@ void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetClassAttractorEntry(const char* entry, const char* att_entry, double StartSize, double EndSize, double ActionRadius, double ConstantRadius) //TODO à finir +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 throw (SALOME::SALOME_Exception) { ASSERT(myBaseImpl); @@ -746,7 +1080,7 @@ void BLSURFPlugin_Hypothesis_i::SetClassAttractorEntry(const char* entry, const } MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry); //if ( valueChanged ) - SMESH::TPythonDump() << _this() << ".SetAttractorGeom(" + SMESH::TPythonDump() << _this() << ".SetAttractorGeom( " << entry << ", " << att_entry << ", "<GetStudyEntry(); + MESSAGE("IDL : GetName : " << GeomObj->GetName()); + MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")"); + SetSizeMapEntry(entry.c_str(), sizeMap); +} + +//============================================================================= + +void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) { ASSERT(myBaseImpl); - string entry; - entry = GeomObj->GetStudyEntry(); + string entry = GeomObj->GetStudyEntry(); + GEOM::shape_type shapeType = GeomObj->GetShapeType(); + if (shapeType == GEOM::COMPOUND) + shapeType = GeomObj->GetMaxShapeType(); MESSAGE("IDL : GetName : " << GeomObj->GetName()); MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")"); - SetSizeMapEntry(entry.c_str(), sizeMap); + SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap); } //============================================================================= @@ -967,7 +1316,7 @@ void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) { SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )"; } -void BLSURFPlugin_Hypothesis_i::SetAttractorGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theAttractor, double StartSize, double EndSize, double ActionRadius, double ConstantRadius) +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) { ASSERT(myBaseImpl); string theFaceEntry; @@ -982,7 +1331,7 @@ void BLSURFPlugin_Hypothesis_i::SetAttractorGeom(GEOM::GEOM_Object_ptr theFace, if (theFaceEntry.empty()) { aName = "Face_"; aName += theFace->GetEntry(); - SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); + SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); if (!theSFace->_is_nil()) theFaceEntry = theSFace->GetID(); } @@ -999,7 +1348,7 @@ void BLSURFPlugin_Hypothesis_i::SetAttractorGeom(GEOM::GEOM_Object_ptr theFace, if (theAttractor->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theAttractor->GetEntry(); - SALOMEDS::SObject_ptr theSAtt = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theAttractor, aName.c_str()); + SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theAttractor, aName.c_str()); if (!theSAtt->_is_nil()) theAttEntry = theSAtt->GetID(); } @@ -1013,32 +1362,44 @@ void BLSURFPlugin_Hypothesis_i::SetAttractorGeom(GEOM::GEOM_Object_ptr theFace, SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius); } -void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace) +void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace, + GEOM::GEOM_Object_ptr theAttractor) { ASSERT(myBaseImpl); - string theFaceEntry; - theFaceEntry = theFace->GetStudyEntry(); + CORBA::String_var theFaceEntry = theFace->GetStudyEntry(); + CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry(); - GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine(); - SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen(); - string aName; + // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine(); + // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen(); + // string aName; - if (theFaceEntry.empty()) { - aName = "Face_"; - aName += theFace->GetEntry(); - SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); - if (!theSFace->_is_nil()) - theFaceEntry = theSFace->GetID(); - } - if (theFaceEntry.empty()) + // if (theFaceEntry.empty()) { + // aName = "Face_"; + // aName += theFace->GetEntry(); + // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); + // if (!theSFace->_is_nil()) + // theFaceEntry = theSFace->GetID(); + // } + if ( !theFaceEntry.in() || !theFaceEntry.in()[0] || + !theAttrEntry.in() || !theAttrEntry.in()[0] ) THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM ); MESSAGE("IDL : GetName : " << theFace->GetName()); MESSAGE("IDL : UNSETATTRACTOR ( "<< theFaceEntry << ")"); - UnsetEntry( theFaceEntry.c_str()); - SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( " << theFaceEntry.c_str() << " )"; + GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() ); + SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( " + << theFace << ", " << theAttractor << " )"; } +void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry, + const char* attractorEntry) +{ + GetImpl()->ClearEntry( faceEntry, attractorEntry ); + SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '" + << faceEntry << "', '" << attractorEntry << "' )"; +} + + /* void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap) {} @@ -1446,7 +1807,7 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, if (theFace->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theFace->GetEntry(); - SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); + SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); if (!theSFace->_is_nil()) theFaceEntry = theSFace->GetID(); } @@ -1484,7 +1845,7 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr the if (theFace->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theFace->GetEntry(); - SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); + SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); if (!theSFace->_is_nil()) theFaceEntry = theSFace->GetID(); } @@ -1539,7 +1900,7 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theF if (theFace->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theFace->GetEntry(); - SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); + SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); if (!theSFace->_is_nil()) theFaceEntry = theSFace->GetID(); } @@ -1552,7 +1913,7 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theF if (theVertex->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theVertex->GetEntry(); - SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str()); + SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str()); if (!theSVertex->_is_nil()) theVertexEntry = theSVertex->GetID(); } @@ -1594,7 +1955,7 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr if (theFace->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theFace->GetEntry(); - SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); + SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); if (!theSFace->_is_nil()) theFaceEntry = theSFace->GetID(); } @@ -1634,7 +1995,7 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Objec if (theFace->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theFace->GetEntry(); - SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); + SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); if (!theSFace->_is_nil()) theFaceEntry = theSFace->GetID(); } @@ -1680,7 +2041,7 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object if (theFace->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theFace->GetEntry(); - SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); + SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); if (!theSFace->_is_nil()) theFaceEntry = theSFace->GetID(); } @@ -1693,7 +2054,7 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object if (theVertex->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theVertex->GetEntry(); - SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str()); + SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str()); if (!theSVertex->_is_nil()) theVertexEntry = theSVertex->GetID(); } @@ -1735,7 +2096,7 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object // if (theFace->GetShapeType() == GEOM::COMPOUND) // aName = "Compound_"; // aName += theFace->GetEntry(); -// SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); +// SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); // if (!theSFace->_is_nil()) // theFaceEntry = theSFace->GetID(); // } @@ -1774,7 +2135,7 @@ BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEO if (theFace->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theFace->GetEntry(); - SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); + SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); if (!theSFace->_is_nil()) theFaceEntry = theSFace->GetID(); } @@ -1810,7 +2171,7 @@ bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFac if (theFace->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theFace->GetEntry(); - SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); + SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); if (!theSFace->_is_nil()) theFaceEntry = theSFace->GetID(); } @@ -1861,7 +2222,7 @@ bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr th if (theFace->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theFace->GetEntry(); - SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); + SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); if (!theSFace->_is_nil()) theFaceEntry = theSFace->GetID(); } @@ -1874,7 +2235,7 @@ bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr th if (theVertex->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theVertex->GetEntry(); - SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str()); + SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str()); if (!theSVertex->_is_nil()) theVertexEntry = theSVertex->GetID(); } @@ -1909,7 +2270,7 @@ bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theF if (theFace->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theFace->GetEntry(); - SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); + SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); if (!theSFace->_is_nil()) theFaceEntry = theSFace->GetID(); } @@ -2232,7 +2593,7 @@ void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Ob if (theFace->GetShapeType() == GEOM::COMPOUND) aName = "Compound_"; aName += theFace->GetEntry(); - SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); + SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str()); if (!theSFace->_is_nil()) theFaceEntry = theSFace->GetID(); } @@ -2321,6 +2682,546 @@ void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFa */ /////////////////////// +/////////////////////// +// PERIODICITY // +/////////////////////// + + +std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType) +{ +//enum shape_type { COMPOUND, COMPSOLID, SOLID, SHELL, FACE, WIRE, EDGE, VERTEX, SHAPE /*, __max_shape_type=0xffffffff */ }; + std::map MapShapeTypeToString; + MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND"); + MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID"); + MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID"); + MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL"); + MapShapeTypeToString[GEOM::FACE] = std::string("FACE"); + MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE"); + MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE"); + MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX"); + MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE"); + std::string txtShapeType = MapShapeTypeToString[theShapeType]; + return txtShapeType; +} + +void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector theShapeTypes) +{ + // Check shape types + bool ok = false; + std::stringstream typesTxt; + for (std::size_t i=0; iGetShapeType() == theShapeType) + ok = true; + typesTxt << ShapeTypeToString(theShapeType); + if (i < theShapeTypes.size()-1 ) + typesTxt << ", "; + } + if (!ok){ + std::stringstream msg; + msg << "shape shape type is not in" << typesTxt; + MESSAGE(msg); + THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM); + } +} + +void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType) +{ + // Check shape type + if (shape->GetShapeType() != theShapeType) { + std::stringstream msg; + msg << "shape shape type is not " << ShapeTypeToString(theShapeType); + MESSAGE(msg); + THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM); + } +} + +std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix) +{ + // Check shape is published in the object browser + string shapeEntry = shape->GetStudyEntry(); + + GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine(); + SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen(); + string aName; + + // Publish shape if needed + if (shapeEntry.empty()) { + if (shape->GetShapeType() == theShapeType) + aName = prefix; + aName += shape->GetEntry(); + SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, shape, aName.c_str()); + if (!theSFace1->_is_nil()) + shapeEntry = theSFace1->GetID(); + } + if (shapeEntry.empty()) + THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM ); + return shapeEntry; +} + +// Format the output of two vectors to use it in MESSAGE and PythonDump +std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector &theSourceVerticesEntries, vector &theTargetVerticesEntries) +{ + std::stringstream listEntriesTxt; + + if (!theSourceVerticesEntries.empty()) + { + listEntriesTxt << ", [" ; + size_t i =0; + for (std::vector::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++) + { + if (i>0) + listEntriesTxt << ", "; + listEntriesTxt << *it; + } + + listEntriesTxt << "], [" ; + i =0; + for (std::vector::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++) + { + if (i>0) + listEntriesTxt << ", "; + listEntriesTxt << *it; + } + listEntriesTxt << "]" ; + } + return listEntriesTxt.str(); +} + +/** + * Erase all PreCad periodicity associations + */ +void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() { + ASSERT(myBaseImpl); + this->GetImpl()->ClearPreCadPeriodicityVectors(); + SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()"; +} + +BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector() +{ + MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector"); + const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector = + this->GetImpl()->_GetPreCadFacesPeriodicityVector(); + + BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector); + + MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector end"); + return periodicityList._retn(); +} + +BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector() +{ + MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector"); + const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector = + this->GetImpl()->_GetPreCadEdgesPeriodicityVector(); + + BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector); + + MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector end"); + return periodicityList._retn(); +} + +// convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence +BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector) +{ + MESSAGE("BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence"); + BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList(); + + periodicityList->length(preCadPeriodicityVector.size()); + + for (size_t i = 0; ishape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str()); + myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str()); + + BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList(); + if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty()) + { + sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size()); + for (size_t j=0; jtheSourceVerticesEntries = sourceVertices; + + BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList(); + if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty()) + { + targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size()); + for (size_t j=0; jtheTargetVerticesEntries = targetVertices; + + periodicityList[i] = myPreCadPeriodicity; + } + + + return periodicityList._retn(); +} + + +void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2) +throw (SALOME::SALOME_Exception) +{ + ASSERT(myBaseImpl); + const GEOM::ListOfGO theSourceVertices; + const GEOM::ListOfGO theTargetVertices; + AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices); +} + + +void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2, + const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices) +throw (SALOME::SALOME_Exception) +{ + ASSERT(myBaseImpl); + MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices"); + + size_t theLength = theSourceVertices.length(); + if (theLength != theTargetVertices.length()) + THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM ); + + std::vector allowedShapeTypes; + allowedShapeTypes.push_back(GEOM::FACE); + allowedShapeTypes.push_back(GEOM::COMPOUND); + + string prefix1 = "Source_face_"; + CheckShapeTypes(theFace1, allowedShapeTypes); + string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1); + + string prefix2 = "Target_face_"; + CheckShapeTypes(theFace2, allowedShapeTypes); + string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2); + + string prefix3 = "Source_vertex_"; + BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList(); + theSourceVerticesEntries->length(theLength); + GEOM::GEOM_Object_ptr theVtx_i; + string theEntry_i; + for (size_t ind = 0; ind < theLength; ind++) { + theVtx_i = theSourceVertices[ind]; + theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3); + theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str()); + } + + string prefix4 = "Target_vertex_"; + BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList(); + theTargetVerticesEntries->length(theLength); + for (size_t ind = 0; ind < theLength; ind++) { + theVtx_i = theTargetVertices[ind]; + theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4); + theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str()); + } + + string theFace2Name = theFace2->GetName(); + MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName()); + MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName()); + MESSAGE("IDL : AddPreCadFacesPeriodicity( "<< theFace1Entry << ", " << theFace2Entry << ")"); + try { + AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(), + theSourceVerticesEntries, theTargetVerticesEntries); + } catch (SALOME_Exception& ex) { + THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM ); + } +} + + +void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry, + const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba) + throw (SALOME::SALOME_Exception) +{ + + ASSERT(myBaseImpl); + + // Convert BLSURFPlugin::TEntryList to vector + vector theSourceVerticesEntries, theTargetVerticesEntries; + for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) { + theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in()); + theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in()); + } + + string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries); + + MESSAGE("IDL : AddPreCadFacesPeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << listEntriesTxt.c_str() << ")"); + + this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry, + theSourceVerticesEntries, theTargetVerticesEntries); + + SMESH::TPythonDump pd; + if (!theSourceVerticesEntries.empty()) + { + pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry; + pd << listEntriesTxt.c_str(); + pd << ")"; + } + else + pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")"; + MESSAGE("IDL : AddPreCadFacesPeriodicityEntry END"); +} + +void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2) + throw (SALOME::SALOME_Exception) +{ + ASSERT(myBaseImpl); + const GEOM::ListOfGO theSourceVertices; + const GEOM::ListOfGO theTargetVertices; + AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices); +} + +void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2, + const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices) + throw (SALOME::SALOME_Exception) +{ + MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices"); + ASSERT(myBaseImpl); + + size_t theLength = theSourceVertices.length(); + if (theLength != theTargetVertices.length()) + THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM ); + + std::vector allowedShapeTypes; + allowedShapeTypes.push_back(GEOM::EDGE); + allowedShapeTypes.push_back(GEOM::COMPOUND); + + string prefix1 = "Source_edge_"; + CheckShapeTypes(theEdge1, allowedShapeTypes); + string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1); + + string prefix2 = "Target_edge_"; + CheckShapeTypes(theEdge2, allowedShapeTypes); + string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2); + + string prefix3 = "Source_vertex_"; + BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList(); + theSourceVerticesEntries->length(theLength); + GEOM::GEOM_Object_ptr theVtx_i; + string theEntry_i; + for (size_t ind = 0; ind < theLength; ind++) { + theVtx_i = theSourceVertices[ind]; + theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3); + theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str()); + } + + string prefix4 = "Target_vertex_"; + BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList(); + theTargetVerticesEntries->length(theLength); + for (size_t ind = 0; ind < theLength; ind++) { + theVtx_i = theTargetVertices[ind]; + theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4); + theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str()); + } + + string theEdge2Name = theEdge2->GetName(); + MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName()); + MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName()); + MESSAGE("IDL : AddPreCadEdgesPeriodicity( "<< theEdge1Entry << ", " << theEdge2Entry << ")"); + try { + AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(), + theSourceVerticesEntries, theTargetVerticesEntries); + } catch (SALOME_Exception& ex) { + THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM ); + } +} + + +void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry, + const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba) + throw (SALOME::SALOME_Exception) +{ + + ASSERT(myBaseImpl); + + // Convert BLSURFPlugin::TEntryList to vector + vector theSourceVerticesEntries, theTargetVerticesEntries; + for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) { + theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in()); + theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in()); + } + + string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries); + + MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry(" << theEdge1Entry << ", " << theEdge2Entry << listEntriesTxt.c_str() << ")"); + this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry, + theSourceVerticesEntries, theTargetVerticesEntries); + + SMESH::TPythonDump pd; + if (!theSourceVerticesEntries.empty()) + { + pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry; + pd << listEntriesTxt.c_str(); + pd << ")"; + } + else + pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")"; + + MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry END"); +} + +void BLSURFPlugin_Hypothesis_i::AddFacePeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2) + throw (SALOME::SALOME_Exception) +{ + ASSERT(myBaseImpl); + + string prefix1 = "Source_face_"; + CheckShapeType(theFace1, GEOM::FACE); + string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1); + string prefix2 = "Target_face_"; + CheckShapeType(theFace2, GEOM::FACE); + string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2); + + MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName()); + MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName()); + MESSAGE("IDL : AddFacePeriodicity( "<< theFace1Entry << ", " << theFace2Entry << ")"); + try { + AddFacePeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str()); + } catch (SALOME_Exception& ex) { + THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM ); + } + + +} + +void BLSURFPlugin_Hypothesis_i::AddFacePeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry) + throw (SALOME::SALOME_Exception){ + + ASSERT(myBaseImpl); + + MESSAGE("IDL : AddFacePeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << ")"); + this->GetImpl()->AddFacePeriodicity(theFace1Entry, theFace2Entry); + SMESH::TPythonDump pd; + pd << _this() << ".AddFacePeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")"; + MESSAGE("IDL : AddFacePeriodicityEntry END"); +} + + +void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theEdge1, + GEOM::GEOM_Object_ptr theFace2, GEOM::GEOM_Object_ptr theEdge2, + CORBA::Long edge_orientation) + throw (SALOME::SALOME_Exception){ + ASSERT(myBaseImpl); + + string prefix_theFace1 = "Source_face_"; + CheckShapeType(theFace1, GEOM::FACE); + string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix_theFace1); + string prefix_theFace2 = "Target_face_"; + CheckShapeType(theFace2, GEOM::FACE); + string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix_theFace2); + + string prefix_theEdge1 = "Source_edge_"; + CheckShapeType(theEdge1, GEOM::EDGE); + string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1); + string prefix_theEdge2 = "Target_edge_"; + CheckShapeType(theEdge2, GEOM::EDGE); + string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2); + + MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName()); + MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName()); + MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName()); + MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName()); + MESSAGE("IDL : AddEdgePeriodicity( "<< theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation << ")"); + try { + AddEdgePeriodicityEntry(theFace1Entry.c_str(), theEdge1Entry.c_str(), theFace2Entry.c_str(), theEdge2Entry.c_str(), edge_orientation); + } catch (SALOME_Exception& ex) { + THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM ); + } + + +} + +void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicityWithoutFaces(GEOM::GEOM_Object_ptr theEdge1, + GEOM::GEOM_Object_ptr theEdge2, + CORBA::Long edge_orientation) + throw (SALOME::SALOME_Exception){ + ASSERT(myBaseImpl); + + string theFace1Entry = ""; + string theFace2Entry = ""; + + string prefix_theEdge1 = "Source_edge_"; + CheckShapeType(theEdge1, GEOM::EDGE); + string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1); + string prefix_theEdge2 = "Target_edge_"; + CheckShapeType(theEdge2, GEOM::EDGE); + string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2); + + MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName()); + MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName()); + MESSAGE("IDL : AddEdgePeriodicity( "<< theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation << ")"); + try { + AddEdgePeriodicityEntry(theFace1Entry.c_str(), theEdge1Entry.c_str(), theFace2Entry.c_str(), theEdge2Entry.c_str(), edge_orientation); + } catch (SALOME_Exception& ex) { + THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM ); + } + + +} + +void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicityEntry(const char* theFace1Entry, const char* theEdge1Entry, const char* theFace2Entry, const char* theEdge2Entry, const long edge_orientation) + throw (SALOME::SALOME_Exception){ + + ASSERT(myBaseImpl); + + MESSAGE("IDL : AddEdgePeriodicityEntry(" << theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation << ")"); + this->GetImpl()->AddEdgePeriodicity(theFace1Entry, theEdge1Entry, theFace2Entry, theEdge2Entry, edge_orientation); + SMESH::TPythonDump pd; + if (theFace1Entry) + pd << _this() << ".AddEdgePeriodicity(" << theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation <<")"; + else + pd << _this() << ".AddEdgePeriodicityWithoutFaces(" << theEdge1Entry << ", " << theEdge2Entry << ", " << edge_orientation <<")"; + MESSAGE("IDL : AddEdgePeriodicityEntry END"); +} + +void BLSURFPlugin_Hypothesis_i::AddVertexPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theVertex1, + GEOM::GEOM_Object_ptr theEdge2, GEOM::GEOM_Object_ptr theVertex2) + throw (SALOME::SALOME_Exception){ + ASSERT(myBaseImpl); + + string prefix_theEdge1 = "Source_edge_"; + CheckShapeType(theEdge1, GEOM::EDGE); + string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1); + string prefix_theEdge2 = "Target_edge_"; + CheckShapeType(theEdge2, GEOM::EDGE); + string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2); + + string prefix_theVertex1 = "Source_vertex_"; + CheckShapeType(theVertex1, GEOM::VERTEX); + string theVertex1Entry = PublishIfNeeded(theVertex1, GEOM::VERTEX, prefix_theVertex1); + string prefix_theVertex2 = "Target_vertex_"; + CheckShapeType(theVertex2, GEOM::VERTEX); + string theVertex2Entry = PublishIfNeeded(theVertex2, GEOM::VERTEX, prefix_theVertex2); + + MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName()); + MESSAGE("IDL : theVertex1->GetName : " << theVertex1->GetName()); + MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName()); + MESSAGE("IDL : theVertex2->GetName : " << theVertex2->GetName()); + MESSAGE("IDL : AddVertexPeriodicity( "<< theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", " << theVertex2Entry << ")"); + try { + AddVertexPeriodicityEntry(theEdge1Entry.c_str(), theVertex1Entry.c_str(), theEdge2Entry.c_str(), theVertex2Entry.c_str()); + } catch (SALOME_Exception& ex) { + THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM ); + } + + +} + +void BLSURFPlugin_Hypothesis_i::AddVertexPeriodicityEntry(const char* theEdge1Entry, const char* theVertex1Entry, const char* theEdge2Entry, const char* theVertex2Entry) + throw (SALOME::SALOME_Exception){ + + ASSERT(myBaseImpl); + + MESSAGE("IDL : AddVertexPeriodicityEntry(" << theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", " << theVertex2Entry << ")"); + this->GetImpl()->AddVertexPeriodicity(theEdge1Entry, theVertex1Entry, theEdge2Entry, theVertex2Entry); + SMESH::TPythonDump pd; + pd << _this() << ".AddVertexPeriodicity(" << theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", " << theVertex2Entry << ")"; + MESSAGE("IDL : AddVertexPeriodicityEntry END"); +} + //================================================================================ /*! @@ -2400,3 +3301,75 @@ char* BLSURFPlugin_Hypothesis_i::GetGMFFile() { CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) { return type == SMESH::DIM_2D; } + +// +// Obsolete methods - To be removed in V7 +// + +void BLSURFPlugin_Hypothesis_i::SetPhyMin(CORBA::Double theMinSize) { + this->SetMinSize(theMinSize); +} +CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMin() { + return this->GetMinSize(); +} +void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize) { + this->SetMaxSize(theMaxSize); +} +CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax() { + return this->GetMaxSize(); +} +void BLSURFPlugin_Hypothesis_i::SetGeoMin(CORBA::Double theMinSize) { + this->SetMinSize(theMinSize); +} +CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMin() { + return this->GetMinSize(); +} +void BLSURFPlugin_Hypothesis_i::SetGeoMax(CORBA::Double theMaxSize) { + this->SetMaxSize(theMaxSize); +} +CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMax() { + return this->GetMaxSize(); +} +void BLSURFPlugin_Hypothesis_i::SetAngleMeshS(CORBA::Double theValue) { + this->SetAngleMesh(theValue); +} +CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS() { + return this->GetAngleMesh(); +} +void BLSURFPlugin_Hypothesis_i::SetAngleMeshC(CORBA::Double theValue) { + this->SetAngleMesh(theValue); +} +CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshC() { + return this->GetAngleMesh(); +} +void BLSURFPlugin_Hypothesis_i::SetDecimesh(CORBA::Boolean theValue) { + std::string theValueStr = theValue ? "1" : "0"; + this->SetOptionValue("respect_geometry",theValueStr.c_str()); +} +CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() { + std::string theValueStr = this->GetOptionValue("respect_geometry"); + if (theValueStr.empty() || theValueStr == "respect") + return true; + return false; +} +void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) { + std::string theValueStr = theValue ? "1" : "0"; + this->SetPreCADOptionValue("remove_tiny_edges",theValueStr.c_str()); +} +CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() { + std::string theValueStr = this->GetPreCADOptionValue("remove_tiny_edges"); + if (theValueStr == "1") + return true; + return false; +} +void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) { + std::ostringstream theValueStr; + theValueStr << theValue; + this->SetPreCADOptionValue("tiny_edge_length",theValueStr.str().c_str()); +} +CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() { + std::istringstream theValueStr(this->GetPreCADOptionValue("tiny_edge_length")); + double result; + theValueStr >> result; + return result; +}