]> SALOME platform Git repositories - plugins/blsurfplugin.git/commitdiff
Salome HOME
Merge multi-study removal branch. Before_python3_27062017
authorrnv <rnv@opencascade.com>
Fri, 9 Jun 2017 10:57:57 +0000 (13:57 +0300)
committerrnv <rnv@opencascade.com>
Fri, 9 Jun 2017 10:57:57 +0000 (13:57 +0300)
13 files changed:
1  2 
src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx
src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx
src/BLSURFPlugin/BLSURFPlugin_BLSURF_i.cxx
src/BLSURFPlugin/BLSURFPlugin_BLSURF_i.hxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx
src/BLSURFPlugin/BLSURFPlugin_i.cxx
src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx
tests/test_enforced_vertex.py
tests/test_precad_intersections.py
tests/test_quadrangles_gradation.py

index 82da99fa3e7b6fa0a0b6ae47d65f869a839e7f5e,434b73268c19ebb78fa8d9da1a9f6dbe4cb7e09b..cf6f1f65304e5c00d9ad8255d77f70ee8be3d78b
@@@ -241,30 -238,20 +241,22 @@@ bool HasSizeMapOnVertex=false
   */
  //=============================================================================
  
 -BLSURFPlugin_BLSURF::BLSURFPlugin_BLSURF(int hypId, SMESH_Gen* gen)
 +BLSURFPlugin_BLSURF::BLSURFPlugin_BLSURF(int        hypId,
-                                          int        studyId,
 +                                         SMESH_Gen* gen,
 +                                         bool       theHasGEOM)
-   : SMESH_2D_Algo(hypId, studyId, gen)
+   : SMESH_2D_Algo(hypId, gen)
  {
 -  MESSAGE("BLSURFPlugin_BLSURF::BLSURFPlugin_BLSURF");
 -
 -  _name = "MG-CADSurf";//"BLSURF";
 +  _name = theHasGEOM ? "MG-CADSurf" : "MG-CADSurf_NOGEOM";//"BLSURF";
    _shapeType = (1 << TopAbs_FACE); // 1 bit /shape type
 -  _compatibleHypothesis.push_back(BLSURFPlugin_Hypothesis::GetHypType());
 -  _compatibleHypothesis.push_back(StdMeshers_ViscousLayers2D::GetHypType());
 +  _compatibleHypothesis.push_back(BLSURFPlugin_Hypothesis::GetHypType(theHasGEOM));
 +  if ( theHasGEOM )
 +    _compatibleHypothesis.push_back(StdMeshers_ViscousLayers2D::GetHypType());
    _requireDiscreteBoundary = false;
    _onlyUnaryInput = false;
    _hypothesis = NULL;
    _supportSubmeshes = true;
 +  _requireShape = theHasGEOM;
  
-   smeshGen_i = SMESH_Gen_i::GetSMESHGen();
-   CORBA::Object_var anObject = smeshGen_i->GetNS()->Resolve("/myStudyManager");
-   SALOMEDS::StudyManager_var aStudyMgr = SALOMEDS::StudyManager::_narrow(anObject);
-   myStudy = NULL;
-   myStudy = aStudyMgr->GetStudyByID(_studyId);
    /* Initialize the Python interpreter */
    assert(Py_IsInitialized());
    PyGILState_STATE gstate;
@@@ -503,19 -430,17 +495,16 @@@ projectionPoint getProjectionPoint(Topo
  /////////////////////////////////////////////////////////
  TopoDS_Shape BLSURFPlugin_BLSURF::entryToShape(std::string entry)
  {
-   TopoDS_Shape S;
-   if ( !entry.empty() )
-   {
-     GEOM::GEOM_Object_var aGeomObj;
-     SALOMEDS::SObject_var aSObj = myStudy->FindObjectID( entry.c_str() );
-     if (!aSObj->_is_nil()) {
-       CORBA::Object_var obj = aSObj->GetObject();
-       aGeomObj = GEOM::GEOM_Object::_narrow(obj);
-       aSObj->UnRegister();
-     }
-     if ( !aGeomObj->_is_nil() )
-       S = smeshGen_i->GeomObjectToShape( aGeomObj.in() );
 -  MESSAGE("BLSURFPlugin_BLSURF::entryToShape "<<entry );
+   GEOM::GEOM_Object_var aGeomObj;
+   TopoDS_Shape S = TopoDS_Shape();
+   SALOMEDS::SObject_var aSObj = SMESH_Gen_i::getStudyServant()->FindObjectID( entry.c_str() );
+   if (!aSObj->_is_nil()) {
+     CORBA::Object_var obj = aSObj->GetObject();
+     aGeomObj = GEOM::GEOM_Object::_narrow(obj);
+     aSObj->UnRegister();
    }
+   if ( !aGeomObj->_is_nil() )
+     S = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( aGeomObj.in() );
    return S;
  }
  
index 60c5e29cbe805857aaf72bbccaf0789110033f0b,e87d33e948395b7daeac601ab9e7e7eea754e1cc..14ff95fb913d5a945f314f86b4293ed9750e7953
@@@ -75,7 -75,7 +75,7 @@@ class TopoDS_Shape
  
  class BLSURFPlugin_BLSURF: public SMESH_2D_Algo {
    public:
-     BLSURFPlugin_BLSURF(int hypId, int studyId, SMESH_Gen* gen, bool theHasGEOM);
 -    BLSURFPlugin_BLSURF(int hypId, SMESH_Gen* gen);
++    BLSURFPlugin_BLSURF(int hypId, SMESH_Gen* gen, bool theHasGEOM);
  
      virtual ~BLSURFPlugin_BLSURF();
  
    private:
        PyObject *          main_mod;
        PyObject *          main_dict;
 -      SMESH_Mesh*         myMesh;
 +      SMESH_MesherHelper* myHelper;
-       SALOMEDS::Study_var myStudy;
-       SMESH_Gen_i*        smeshGen_i;
  
        volatile bool _compute_canceled;
  };
index 947bf7187134092eadc0703aedf663ac93966b58,b2235158cf9a5857c43d3132af9d5f8b07b063ea..ea8a9f9d56b4ee638468191b16f81dd86097c679
  //=============================================================================
  
  BLSURFPlugin_BLSURF_i::BLSURFPlugin_BLSURF_i( PortableServer::POA_ptr thePOA,
-                                               int                     theStudyId,
 -                                              ::SMESH_Gen*            theGenImpl )
 +                                              ::SMESH_Gen*            theGenImpl,
 +                                              bool                    theHasGEOM )
       : SALOME::GenericObj_i( thePOA ), 
         SMESH_Hypothesis_i( thePOA ), 
         SMESH_Algo_i( thePOA ),
         SMESH_2D_Algo_i( thePOA )
  {
 -  MESSAGE( "BLSURFPlugin_BLSURF_i::BLSURFPlugin_BLSURF_i" );
    myBaseImpl = new ::BLSURFPlugin_BLSURF( theGenImpl->GetANewId(),
-                                           theStudyId,
 -                                          theGenImpl );
 +                                          theGenImpl,
 +                                          theHasGEOM);
  }
  
  //=============================================================================
index 1b3b30db1c50f913c83926aaa7b4857445612d43,3d382ee6cd0e09705c25633de36e26069d50725c..8c1d5707dd4e18d00ecd3c525f1a103dbc79cb17
@@@ -41,9 -41,7 +41,8 @@@ class BLSURFPlugin_BLSURF_i
  public:
    // Constructor
    BLSURFPlugin_BLSURF_i( PortableServer::POA_ptr thePOA,
-                          int                     theStudyId,
 -                         ::SMESH_Gen*            theGenImpl );
 +                         ::SMESH_Gen*            theGenImpl,
 +                         bool                    theHasGEOM);
    // Destructor
    virtual ~BLSURFPlugin_BLSURF_i();
   
index d567f50e71685b858392aa3753db1bac50046bed,12d12bfdfbecbf082ca6bc31fcb0672cda5cbc77..0d8d9f99d4b92cc2af2570a375bdfa87f42c845e
@@@ -49,8 -49,8 +49,8 @@@ namespac
  }
  
  //=============================================================================
- BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen, bool hasgeom) :
-   SMESH_Hypothesis(hypId, studyId, gen), 
 -BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, SMESH_Gen * gen) :
 -  SMESH_Hypothesis(hypId, gen),
++BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, SMESH_Gen * gen, bool hasgeom) :
++  SMESH_Hypothesis(hypId, gen), 
    _physicalMesh(GetDefaultPhysicalMesh()),
    _geometricMesh(GetDefaultGeometricMesh()),
    _phySize(GetDefaultPhySize()),
  
  TopoDS_Shape BLSURFPlugin_Hypothesis::entryToShape(std::string entry)
  {
 -  MESSAGE("BLSURFPlugin_Hypothesis::entryToShape "<<entry );
    GEOM::GEOM_Object_var aGeomObj;
-   SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
-   SALOMEDS::Study_ptr myStudy = smeshGen_i->GetCurrentStudy();
    
    TopoDS_Shape S = TopoDS_Shape();
-   SALOMEDS::SObject_var aSObj = myStudy->FindObjectID( entry.c_str() );
+   SALOMEDS::SObject_var aSObj = SMESH_Gen_i::getStudyServant()->FindObjectID( entry.c_str() );
    if (!aSObj->_is_nil() ) {
      CORBA::Object_var obj = aSObj->GetObject();
      aGeomObj = GEOM::GEOM_Object::_narrow(obj);
index 1531872641aeb3787c63124c492b9ce55a03f6c9,1d8c200aa747922b1b61259a28a4f384936bdb2e..4153e56b2e31c72b579061d2e65a7ea325c80aa8
@@@ -43,7 -43,7 +43,7 @@@
  class BLSURFPlugin_Hypothesis: public SMESH_Hypothesis
  {
  public:
-   BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen, bool hasgeom);
 -  BLSURFPlugin_Hypothesis(int hypId, SMESH_Gen * gen);
++  BLSURFPlugin_Hypothesis(int hypId, SMESH_Gen * gen, bool hasgeom);
  
    enum Topology {
      FromCAD,
   */
    
    typedef std::multimap< std::string, BLSURFPlugin_Attractor* > TAttractorMap;
--  typedef std::map< std::string, std::vector<double> > TParamsMap; //TODO à finir 
++  typedef std::map< std::string, std::vector<double> > TParamsMap; //TODO ?? finir 
    
    void SetClassAttractorEntry(const std::string& entry, const std::string& att_entry, double StartSize, double EndSize, double ActionRadius, double ConstantRadius);
    std::string  GetClassAttractorEntry(const std::string& entry);
index 3eef21beb1a39d0645e4ab3597ea7d89027e6f7a,8939ad53a26933ce7f3ec0635587b1ac20ef75e4..a9d96cf7d19fb1258e48ebabcd74d70ba9699fc1
@@@ -47,15 -47,10 +47,14 @@@ using namespace std
   */
  //=============================================================================
  BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA,
-                                                      int                     theStudyId,
 -    ::SMESH_Gen* theGenImpl) :
 -  SALOME::GenericObj_i(thePOA), SMESH_Hypothesis_i(thePOA) {
 -  MESSAGE( "BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i" );
 -  myBaseImpl = new ::BLSURFPlugin_Hypothesis(theGenImpl->GetANewId(), theGenImpl);
 +                                                     ::SMESH_Gen*            theGenImpl,
 +                                                     bool                    theHasGEOM) :
 +  SALOME::GenericObj_i(thePOA), SMESH_Hypothesis_i(thePOA)
 +{
 +  myBaseImpl = new ::BLSURFPlugin_Hypothesis(theGenImpl->GetANewId(),
-                                              theStudyId,
++                                             
 +                                             theGenImpl,
 +                                             theHasGEOM);
  }
  
  //=============================================================================
@@@ -1759,7 -1753,7 +1758,7 @@@ void BLSURFPlugin_Hypothesis_i::SetAttr
  
  //=============================================================================
  
--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
++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);
@@@ -1822,7 -1818,7 +1821,7 @@@ char* BLSURFPlugin_Hypothesis_i::GetAtt
  
  // //=============================================================================
  // 
--// // TODO coder cette fonction (utilisée pour savoir si la valeur a changé
++// // TODO coder cette fonction (utilis??e pour savoir si la valeur a chang??
  // // A finir pour le dump
  // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
  //   throw (SALOME::SALOME_Exception)
@@@ -2903,197 -2969,13 +2889,197 @@@ bool BLSURFPlugin_Hypothesis_i::UnsetEn
  }
  
  /*!
 - * Set/get/unset an enforced vertex on geom object given by entry
 + * Set/get/unset an enforced vertex on face - NEW (no face)
 + */
 +bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
 +{
 +  ASSERT(myBaseImpl);
 +
 +  try {
 +    return SetEnforcedVertexEntry("", x, y, z);
 +  } catch (SALOME_Exception& ex) {
 +    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
 +  }
 +}
 +
 +/*!
 + * Set/get/unset an enforced vertex with name on face
 + */
 +bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception)
 +{
 +  try {
 +    return SetEnforcedVertexEntry("", x, y, z, theVertexName);
 +  } catch (SALOME_Exception& ex) {
 +    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
 +  }
 +}
 +
 +/*!
 + * Set/get/unset an enforced vertex with geom object on face
 + */
 +bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
 +  throw (SALOME::SALOME_Exception)
 +{
 +  if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
 +    THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
 +  }
 +  string theVertexEntry = theVertex->GetStudyEntry();
 +  
 +  GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
 +  SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
 +  string aName;
 +  
 +  if (theVertexEntry.empty()) {
 +    if (theVertex->GetShapeType() == GEOM::VERTEX)
 +      aName = "Vertex_";
 +    if (theVertex->GetShapeType() == GEOM::COMPOUND)
 +      aName = "Compound_";
 +    aName += theVertex->GetEntry();
-     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
++    SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
 +    if (!theSVertex->_is_nil())
 +      theVertexEntry = theSVertex->GetID();
 +  }
 +  if (theVertexEntry.empty())
 +    THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
 +
 +  string theVertexName = theVertex->GetName();
 +  try {
 +    return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
 +  } catch (SALOME_Exception& ex) {
 +    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
 +  }
 +}
 +
 +/*!
 + * Set an enforced vertex with group name on face
 + */
 +bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
 +  throw (SALOME::SALOME_Exception)
 +{
 +  ASSERT(myBaseImpl);
 +
 +  try {
 +    return SetEnforcedVertexEntry("", x, y, z, "", "", theGroupName);
 +  } catch (SALOME_Exception& ex) {
 +    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
 +  }
 +}
 +
 +/*!
 + * Set an enforced vertex with name and group name on face
   */
 -bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
 -    CORBA::Double z, const char* theVertexName, const char* theVertexEntry, const char* theGroupName)
 -    throw (SALOME::SALOME_Exception) {
 +bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, 
 +                                                                const char* theVertexName, const char* theGroupName)
 +  throw (SALOME::SALOME_Exception)
 +{
    ASSERT(myBaseImpl);
 -  MESSAGE("IDL : SetEnforcedVertexEntry(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\")");
 +
 +  try {
 +    return SetEnforcedVertexEntry("", x, y, z, theVertexName, "", theGroupName);
 +  } catch (SALOME_Exception& ex) {
 +    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
 +  }
 +}
 +
 +/*!
 + * Set an enforced vertex with geom entry and group name on face
 + */
 +bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
 +  throw (SALOME::SALOME_Exception)
 +{
 +  if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
 +    THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
 +  }
 +
 +  string theVertexEntry = theVertex->GetStudyEntry();
 +  
 +  GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
 +  SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
 +  string aName;
 +  
 +  if (theVertexEntry.empty()) {
 +    if (theVertex->GetShapeType() == GEOM::VERTEX)
 +      aName = "Vertex_";
 +    if (theVertex->GetShapeType() == GEOM::COMPOUND)
 +      aName = "Compound_";
 +    aName += theVertex->GetEntry();
-     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
++    SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
 +    if (!theSVertex->_is_nil())
 +      theVertexEntry = theSVertex->GetID();
 +  }
 +  if (theVertexEntry.empty())
 +    THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
 +
 +  string theVertexName = theVertex->GetName();
 +  try {
 +    return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
 +  } catch (SALOME_Exception& ex) {
 +    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
 +  }
 +}
 +
 +bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
 +{
 +  try {
 +    return UnsetEnforcedVertexEntry("", x, y, z);
 +  } catch (SALOME_Exception& ex) {
 +    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
 +  }
 +}
 +
 +bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
 +  throw (SALOME::SALOME_Exception)
 +{
 +  if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
 +    THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
 +  }
 +  std::string theVertexEntry = theVertex->GetStudyEntry();
 +  
 +  GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
 +  SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
 +  string aName;
 +  
 +  if (theVertexEntry.empty()) {
 +    if (theVertex->GetShapeType() == GEOM::VERTEX)
 +      aName = "Vertex_";
 +    if (theVertex->GetShapeType() == GEOM::COMPOUND)
 +      aName = "Compound_";
 +    aName += theVertex->GetEntry();
-     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
++    SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
 +    if (!theSVertex->_is_nil())
 +      theVertexEntry = theSVertex->GetID();
 +  }
 +  if (theVertexEntry.empty())
 +    THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
 +  
 +  try {
 +    return UnsetEnforcedVertexEntry("", 0, 0, 0, theVertexEntry.c_str());
 +  } catch (SALOME_Exception& ex) {
 +    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
 +  }
 +}
 +
 +bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertices() throw (SALOME::SALOME_Exception)
 +{
 +  try {
 +    return UnsetEnforcedVerticesEntry("");
 +  } catch (SALOME_Exception& ex) {
 +    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
 +  }
 +}
 +
 +/*!
 + * Set/get/unset an enforced vertex on geom object given by entry
 + */
 +bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry,
 +                                                       CORBA::Double x,
 +                                                       CORBA::Double y,
 +                                                       CORBA::Double z,
 +                                                       const char* theVertexName,
 +                                                       const char* theVertexEntry,
 +                                                       const char* theGroupName)
 +  throw (SALOME::SALOME_Exception)
 +{
    bool newValue = false;
    if (string(theVertexEntry).empty()) {
      try {
@@@ -3307,50 -3246,99 +3293,50 @@@ char* BLSURFPlugin_Hypothesis_i::GetInt
  /*
   * Enable internal enforced vertices on specific face if requested by user
   *
 -void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
 + void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
   throw (SALOME::SALOME_Exception)
 -{
 -  MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFace");
 -  try {
 -    SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
 -  } catch (SALOME_Exception& ex) {
 -    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
 -  }
 -}
 + {
 + try {
 + SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
 + } catch (SALOME_Exception& ex) {
 + THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
 + }
 + }
  
 -void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
 + void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
   throw (SALOME::SALOME_Exception)
 -{
 -  MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceWithGroup");
 -
 -  if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
 -    MESSAGE("theFace shape type is not FACE or COMPOUND");
 -    THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
 -  }
 -
 -  string theFaceEntry = theFace->GetStudyEntry();
 -
 -  if (theFaceEntry.empty()) {
 -    GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
 -    string aName;
 -    if (theFace->GetShapeType() == GEOM::FACE)
 -      aName = "Face_";
 -    if (theFace->GetShapeType() == GEOM::COMPOUND)
 -      aName = "Compound_";
 -    aName += theFace->GetEntry();
 -    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
 -    if (!theSFace->_is_nil())
 -      theFaceEntry = theSFace->GetID();
 -  }
 -  if (theFaceEntry.empty())
 -    THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
 -
 -  MESSAGE("IDL : GetName : " << theFace->GetName());
 -  MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
 -  try {
 -    SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
 -  } catch (SALOME_Exception& ex) {
 -    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
 -  }
 -}
 + {
  
 -void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
 -    throw (SALOME::SALOME_Exception)
 -{
 -  MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceEntry");
 -  ASSERT(myBaseImpl);
 -  try {
 -    this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
 -    std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
 -    if (string(theGroupName).empty())
 -      SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
 -    else
 -      SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
 -  } catch (const std::exception& ex) {
 -    std::cout << "Exception: " << ex.what() << std::endl;
 -    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
 -  }
 -}
 + if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
 + THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
 + }
  
 -*/
 + string theFaceEntry = theFace->GetStudyEntry();
 +
 + if (theFaceEntry.empty()) {
 + GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
 + SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
 + string aName;
 + if (theFace->GetShapeType() == GEOM::FACE)
 + aName = "Face_";
 + if (theFace->GetShapeType() == GEOM::COMPOUND)
 + aName = "Compound_";
 + aName += theFace->GetEntry();
-  SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
++ SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
 + if (!theSFace->_is_nil())
 + theFaceEntry = theSFace->GetID();
 + }
 + if (theFaceEntry.empty())
 + THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
  
 -/* TODO GROUPS
 - char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
 - throw (SALOME::SALOME_Exception)
 - {
 - ASSERT(myBaseImpl);
 - MESSAGE("ENGINE : GetEnforcedVertexGroupName START ");
   try {
 - return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
 - }
 - catch (const std::invalid_argument& ex) {
 - SALOME::ExceptionStruct ExDescription;
 - ExDescription.text = ex.what();
 - ExDescription.type = SALOME::BAD_PARAM;
 - ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
 - ExDescription.lineNumber = 1146;
 - throw SALOME::SALOME_Exception(ExDescription);
 - }
 - catch (SALOME_Exception& ex) {
 + SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
 + } catch (SALOME_Exception& ex) {
   THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
   }
 - MESSAGE("ENGINE : GetEnforcedVertexGroupName END ");
 - return 0;
   }
  
 -
 - void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
 + void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
   throw (SALOME::SALOME_Exception)
   {
   ASSERT(myBaseImpl);
index aceec48f0f89a4c00e7bce4f55afe3797fc17358,3e19cd4273d6e17c9e67a3fb2013dc536572d33f..020299e3531a8491cf1af1cab4b11ff55f7b8c21
@@@ -37,16 -37,11 +37,15 @@@ class GEOM_Object
  
  // BLSURFPlugin parameters hypothesis
  
 -class BLSURFPlugin_Hypothesis_i: public virtual POA_BLSURFPlugin::BLSURFPlugin_Hypothesis,
 -    public virtual SMESH_Hypothesis_i {
 +class BLSURFPlugin_Hypothesis_i:
 +  public virtual POA_BLSURFPlugin::BLSURFPlugin_Hypothesis,
 +  public virtual SMESH_Hypothesis_i
 +{
  public:
    // Constructor
 -  BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA, ::SMESH_Gen* theGenImpl);
 +  BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA,
-                             int                     theStudyId,
 +                            ::SMESH_Gen*            theGenImpl,
 +                            bool                    theHasGEOM);
    // Destructor
    virtual ~BLSURFPlugin_Hypothesis_i();
  
index 9cefe5c4cb0a3ea9d40bb31486ca3c44e6255c90,f357ebdc421e5ee3d1a1ba1feddc06cc37ce8dca..9d0296c996a1033271546fc8e03f2f846f325a82
  #include "BLSURFPlugin_BLSURF_i.hxx"
  #include "BLSURFPlugin_Hypothesis_i.hxx"
  
 -template <class T> class BLSURFPlugin_Creator_i:public HypothesisCreator_i<T>
 +template <class T, bool NOGEOM>
 +class BLSURFPlugin_Creator_i : public GenericHypothesisCreator_i
  {
-                                      int                     theStudyId,
 +  // Create a hypothesis
 +  virtual SMESH_Hypothesis_i* Create(PortableServer::POA_ptr thePOA,
-     return new T (thePOA, theStudyId, theGenImpl, !NOGEOM);
 +                                     ::SMESH_Gen*            theGenImpl)
 +  {
++    return new T (thePOA, theGenImpl, !NOGEOM);
 +  }
 +
    // as we have 'module BLSURFPlugin' in BLSURFPlugin_Algorithm.idl
    virtual std::string GetModuleName() { return "BLSURFPlugin"; }
  };
index a96de400db33120837d4f35ac998d430e3991dfd,395c75a99a76793b15912767fddb1657d9a53ef9..1f5470b8fdaa11c915afe77a1e72abe9dde0e5de
@@@ -5,8 -5,10 +5,8 @@@ import mat
  
  import GEOM
  from salome.geom import geomBuilder
- geompy = geomBuilder.New(salome.myStudy)
+ geompy = geomBuilder.New()
  
 -r = 10
 -dist = 10
  dist_coin = 10.1
  
  p1 = geompy.MakeVertex(0., 0., 0.)
@@@ -51,21 -38,15 +51,22 @@@ algo2d.SetAngleMesh( 4 
  algo2d.SetPhySize( 8 )
  
  algo2d.SetEnforcedVertex(left, dist_coin, 0, dist_coin)
 +algo2d.AddEnforcedVertexGeom( pp )
 +algo2d.AddEnforcedVertexGeom( p6 )
 +algo2d.AddEnforcedVertex( *xyz7 )
  
 -Mesh.Compute()
 +assert Mesh.Compute()
 +assert not Mesh.FindCoincidentNodes( 1e-7 )
  
 -id_node = Mesh.FindNodeClosestTo(dist_coin, 0, dist_coin)
 +for x,y,z in allEnforcedCoords:
  
 -x, y, z = Mesh.GetNodeXYZ(id_node)
 +    id_node = Mesh.FindNodeClosestTo( x,y,z )
 +    xn, yn, zn = Mesh.GetNodeXYZ( id_node )
  
 -assert("%.2f, %.2f, %.2f"%(x, y, z) == "%.2f, %.2f, %.2f"%(dist_coin, 0, dist_coin))
 +    # compare X and Z
 +    assert "%.2f, %.2f"%(x, z) == "%.2f, %.2f"%( xn, zn ), \
 +        "%.2f, %.2f, %.2f != %.2f, %.2f, %.2f"%( xn, yn, zn, x,y,z )
  
  
- salome.sg.updateObjBrowser(True)
+ salome.sg.updateObjBrowser()
Simple merge
Simple merge