]> SALOME platform Git repositories - plugins/blsurfplugin.git/commitdiff
Salome HOME
Add possibility to add enforced verteces on faces or group of faces.
authornge <nge>
Thu, 1 Oct 2009 12:37:34 +0000 (12:37 +0000)
committernge <nge>
Thu, 1 Oct 2009 12:37:34 +0000 (12:37 +0000)
The mesh will pass through this verteces if their projection are in the face.

idl/BLSURFPlugin_Algorithm.idl
src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx

index 470dffc043133e0823040c996b9048207280a42a..4e06ed18f65df624f8ca002f71b576ff812ad8af 100644 (file)
 module BLSURFPlugin
 {
   typedef sequence<string> string_array;
-
+  typedef sequence<double,3> TEnforcedVertex;
+  typedef sequence<TEnforcedVertex> TEnforcedVertexList;
+  struct TEnforcedVertexMapElement {
+    string entry;
+    TEnforcedVertexList vertexList;
+  };
+  typedef sequence<TEnforcedVertexMapElement> TEnforcedVertexMap;
+  
   /*!
    * BLSURFPlugin_BLSURF: interface of BLSURF algorithm
    */
@@ -172,7 +179,7 @@ module BLSURFPlugin
     void UnsetEntry(in string entry);
 
     /*!
-     * Set a SizeMap on geom object
+     * Set/unset a SizeMap on geom object
      */
     void         SetSizeMap(in GEOM::GEOM_Object GeomObj, in string sizeMap);
     void         UnsetSizeMap(in GEOM::GEOM_Object GeomObj);
@@ -185,7 +192,7 @@ module BLSURFPlugin
     string_array GetSizeMapEntries();
 
     /*!
-     * Set an attractor on geom object
+     * Set/unset an attractor on geom object
      */
     void         SetAttractor(in GEOM::GEOM_Object GeomObj, in string attractor);
     void         UnsetAttractor(in GEOM::GEOM_Object GeomObj);
@@ -204,6 +211,39 @@ module BLSURFPlugin
     void         UnsetCustomSizeMap(in GEOM::GEOM_Object GeomObj);
     string_array GetCustomSizeMapEntries();
 */
+    ///////////////////////
+    // ENFORCED VERTEXES //
+    ///////////////////////
+    
+    TEnforcedVertexMap GetAllEnforcedVerteces();
+    void               ClearAllEnforcedVerteces();
+    
+    /*!
+     * Set/get/unset an enforced vertex on geom object
+     */
+    void         SetEnforcedVertex(in GEOM::GEOM_Object GeomObj, in double x, in double y, in double z) raises (SALOME::SALOME_Exception);
+//     void         SetEnforcedVertexList(in GEOM::GEOM_Object GeomObj, in TEnforcedVertexList vertexList) raises (SALOME::SALOME_Exception);
+    
+    TEnforcedVertexList GetEnforcedVerteces(in GEOM::GEOM_Object GeomObj) raises (SALOME::SALOME_Exception);
+    
+    void         UnsetEnforcedVertex(in GEOM::GEOM_Object GeomObj, in double x, in double y, in double z) raises (SALOME::SALOME_Exception);
+//     void         UnsetEnforcedVertexList(in GEOM::GEOM_Object GeomObj, in TEnforcedVertexList vertexList) raises (SALOME::SALOME_Exception);
+    void         UnsetEnforcedVerteces(in GEOM::GEOM_Object GeomObj) raises (SALOME::SALOME_Exception);
+    
+//    /*!
+//     * Set/get/unset an enforced vertex on geom object given by entry
+//     */
+//     void         SetEnforcedVertexEntry(in string entry, in double x, in double y, in double z) raises (SALOME::SALOME_Exception);
+//     void         SetEnforcedVertexListEntry(in string entry, in TEnforcedVertexList vertexList) raises (SALOME::SALOME_Exception);
+//     
+//     TEnforcedVertexList GetEnforcedVertexListEntry(in string entry) raises (SALOME::SALOME_Exception);
+//     
+//     void         UnsetEnforcedVertexEntry(in string entry, in double x, in double y, in double z) raises (SALOME::SALOME_Exception);
+//     void         UnsetEnforcedVertexListEntry(in string entry, in TEnforcedVertexList vertexList) raises (SALOME::SALOME_Exception);
+//     void         UnsetEnforcedVertecesEntry(in string entry) raises (SALOME::SALOME_Exception);
+    
+    ///////////////////////
+
   };
 };
 
index e50e1f413de515d4e12631fdb28ebb047e040cc6..ae1122a4766c78208d326149177820879fcb21aa 100644 (file)
@@ -38,6 +38,7 @@
 #include <limits>
 #include <list>
 #include <vector>
+#include <set>
 #include <cstdlib>
 
 #include <BRep_Tool.hxx>
@@ -128,48 +129,48 @@ static PyTypeObject PyStdOut_Type = {
   /* The ob_type field must be initialized in the module init function
    * to be portable to Windows without using C++. */
   PyObject_HEAD_INIT(NULL)
-  0,      /*ob_size*/
-  "PyOut",   /*tp_name*/
-  sizeof(PyStdOut),  /*tp_basicsize*/
-  0,      /*tp_itemsize*/
+  0,                            /*ob_size*/
+  "PyOut",                      /*tp_name*/
+  sizeof(PyStdOut),             /*tp_basicsize*/
+  0,                            /*tp_itemsize*/
   /* methods */
   (destructor)PyStdOut_dealloc, /*tp_dealloc*/
-  0,      /*tp_print*/
-  0, /*tp_getattr*/
-  0, /*tp_setattr*/
-  0,      /*tp_compare*/
-  0,      /*tp_repr*/
-  0,      /*tp_as_number*/
-  0,      /*tp_as_sequence*/
-  0,      /*tp_as_mapping*/
-  0,      /*tp_hash*/
-        0,                      /*tp_call*/
-        0,                      /*tp_str*/
-        PyObject_GenericGetAttr,                      /*tp_getattro*/
-        /* softspace is writable:  we must supply tp_setattro */
-        PyObject_GenericSetAttr,    /* tp_setattro */
-        0,                      /*tp_as_buffer*/
-        Py_TPFLAGS_DEFAULT,     /*tp_flags*/
-        0,                      /*tp_doc*/
-        0,                      /*tp_traverse*/
-        0,                      /*tp_clear*/
-        0,                      /*tp_richcompare*/
-        0,                      /*tp_weaklistoffset*/
-        0,                      /*tp_iter*/
-        0,                      /*tp_iternext*/
-        PyStdOut_methods,                      /*tp_methods*/
-        PyStdOut_memberlist,                      /*tp_members*/
-        0,                      /*tp_getset*/
-        0,                      /*tp_base*/
-        0,                      /*tp_dict*/
-        0,                      /*tp_descr_get*/
-        0,                      /*tp_descr_set*/
-        0,                      /*tp_dictoffset*/
-        0,                      /*tp_init*/
-        0,                      /*tp_alloc*/
-        0,                      /*tp_new*/
-        0,                      /*tp_free*/
-        0,                      /*tp_is_gc*/
+  0,                            /*tp_print*/
+  0,                            /*tp_getattr*/
+  0,                            /*tp_setattr*/
+  0,                            /*tp_compare*/
+  0,                            /*tp_repr*/
+  0,                            /*tp_as_number*/
+  0,                            /*tp_as_sequence*/
+  0,                            /*tp_as_mapping*/
+  0,                            /*tp_hash*/
+  0,                            /*tp_call*/
+  0,                            /*tp_str*/
+  PyObject_GenericGetAttr,      /*tp_getattro*/
+  /* softspace is writable:  we must supply tp_setattro */
+  PyObject_GenericSetAttr,      /* tp_setattro */
+  0,                            /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT,           /*tp_flags*/
+  0,                            /*tp_doc*/
+  0,                            /*tp_traverse*/
+  0,                            /*tp_clear*/
+  0,                            /*tp_richcompare*/
+  0,                            /*tp_weaklistoffset*/
+  0,                            /*tp_iter*/
+  0,                            /*tp_iternext*/
+  PyStdOut_methods,             /*tp_methods*/
+  PyStdOut_memberlist,          /*tp_members*/
+  0,                            /*tp_getset*/
+  0,                            /*tp_base*/
+  0,                            /*tp_dict*/
+  0,                            /*tp_descr_get*/
+  0,                            /*tp_descr_set*/
+  0,                            /*tp_dictoffset*/
+  0,                            /*tp_init*/
+  0,                            /*tp_alloc*/
+  0,                            /*tp_new*/
+  0,                            /*tp_free*/
+  0,                            /*tp_is_gc*/
 };
 
 PyObject * newPyStdOut( std::string& out )
@@ -200,6 +201,9 @@ std::map<int,PyObject*> VertexId2PythonSmp;
 
 std::map<int,std::vector<double> > FaceId2AttractorCoords;
 
+TopTools_IndexedMapOfShape FacesWithEnforcedVerteces;
+std::map< int, std::set< std::vector<double> > > FaceId2EnforcedVertexCoords;
+
 bool HasSizeMapOnFace=false;
 bool HasSizeMapOnEdge=false;
 bool HasSizeMapOnVertex=false;
@@ -258,6 +262,8 @@ BLSURFPlugin_BLSURF::BLSURFPlugin_BLSURF(int hypId, int studyId,
   EdgeId2PythonSmp.clear();
   VertexId2PythonSmp.clear();
   FaceId2AttractorCoords.clear();
+  FacesWithEnforcedVerteces.Clear();
+  FaceId2EnforcedVertexCoords.clear();
 
 }
 
@@ -351,9 +357,9 @@ typedef struct {
        gp_XYZ xyz;
 } projectionPoint;
 /////////////////////////////////////////////////////////
-projectionPoint getUV(const TopoDS_Face& face, const gp_XYZ& point)
+projectionPoint getProjectionPoint(const TopoDS_Face& face, const gp_XYZ& point)
 {
-       projectionPoint myPoint;
+  projectionPoint myPoint;
   Handle(Geom_Surface) surface = BRep_Tool::Surface(face);
   GeomAPI_ProjectPointOnSurf projector( point, surface );
   if ( !projector.IsDone() || projector.NbPoints()==0 )
@@ -366,7 +372,6 @@ projectionPoint getUV(const TopoDS_Face& face, const gp_XYZ& point)
   myPoint.xyz = gp_XYZ(aPnt.X(),aPnt.Y(),aPnt.Z());
   //return gp_XY(u,v);
   return myPoint;
-  
 }
 /////////////////////////////////////////////////////////
 
@@ -384,38 +389,79 @@ double getT(const TopoDS_Edge& edge, const gp_XYZ& point)
 /////////////////////////////////////////////////////////
 TopoDS_Shape BLSURFPlugin_BLSURF::entryToShape(std::string entry)
 {
-    MESSAGE("BLSURFPlugin_BLSURF::entryToShape"<<entry );
-    TopoDS_Shape S = TopoDS_Shape();
-    SALOMEDS::SObject_var aSO = myStudy->FindObjectID(entry.c_str());
-    SALOMEDS::GenericAttribute_var anAttr;
-    if (!aSO->_is_nil()){
-      SALOMEDS::SObject_var aRefSObj;
-      GEOM::GEOM_Object_var aShape;
-      SALOMEDS::AttributeIOR_var myAttribute;
-      CORBA::String_var myAttrValue;
-      CORBA::Object_var myCorbaObj;
-      // If selected object is a reference
-      if ( aSO->ReferencedObject( aRefSObj ))
-        aSO = aRefSObj;
-      SALOMEDS::SComponent_var myFatherCpnt = aSO->GetFatherComponent();
-      CORBA::String_var myFatherCpntDataType = myFatherCpnt->ComponentDataType();
-      if (  strcmp(myFatherCpntDataType,"GEOM")==0) {
-        MESSAGE("aSO father component is GEOM");
-        if (!aSO->FindAttribute(anAttr, "AttributeIOR")) return S;
-        myAttribute=SALOMEDS::AttributeIOR::_narrow(anAttr);
-        myAttrValue=myAttribute->Value();
-        MESSAGE("aSO IOR: "<< myAttrValue);
-        myCorbaObj=smeshGen_i->GetORB()->string_to_object(myAttrValue);
-        aShape = GEOM::GEOM_Object::_narrow(myCorbaObj);
-      }
-      if ( !aShape->_is_nil() )
-        S=smeshGen_i->GeomObjectToShape( aShape.in() );
-    }
-    return S;
+  MESSAGE("BLSURFPlugin_BLSURF::entryToShape"<<entry );
+  GEOM::GEOM_Object_var aGeomObj;
+  TopoDS_Shape S = TopoDS_Shape();
+  SALOMEDS::SObject_var aSObj = myStudy->FindObjectID( entry.c_str() );
+  SALOMEDS::GenericAttribute_var anAttr;
+
+  if (!aSObj->_is_nil() && aSObj->FindAttribute(anAttr, "AttributeIOR")) {
+    SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+    CORBA::String_var aVal = anIOR->Value();
+    CORBA::Object_var obj = myStudy->ConvertIORToObject(aVal);
+    aGeomObj = GEOM::GEOM_Object::_narrow(obj);
+  }
+  if ( !aGeomObj->_is_nil() )
+    S = smeshGen_i->GeomObjectToShape( aGeomObj.in() );
+  return S;
 }
 
 /////////////////////////////////////////////////////////
+void createEnforcedVertexOnFace(TopoDS_Shape GeomShape, BLSURFPlugin_Hypothesis::TEnforcedVertexList enforcedVertexList)
+{
+  double xe, ye, ze;
+  std::vector<double> coords;
+  BLSURFPlugin_Hypothesis::TEnforcedVertex enforcedVertex;
+  // enforcedVertexList = set < vector<double> >
+  BLSURFPlugin_Hypothesis::TEnforcedVertexList::const_iterator evlIt = enforcedVertexList.begin();
+
+  for( ; evlIt != enforcedVertexList.end() ; ++evlIt ) {
+    coords.clear();
+    enforcedVertex = *evlIt;
+    xe = enforcedVertex[0];
+    ye = enforcedVertex[1];
+    ze = enforcedVertex[2];
+    MESSAGE("Enforced Vertex: " << xe << ", " << ye << ", " << ze);
+    // Get the (u,v) values of the enforced vertex on the face
+    projectionPoint myPoint = getProjectionPoint(TopoDS::Face(GeomShape),gp_XYZ(xe,ye,ze));
+    gp_XY uvPoint = myPoint.uv;
+    gp_XYZ xyzPoint = myPoint.xyz;
+    Standard_Real u0 = uvPoint.X();
+    Standard_Real v0 = uvPoint.Y();
+    Standard_Real x0 = xyzPoint.X();
+    Standard_Real y0 = xyzPoint.Y();
+    Standard_Real z0 = xyzPoint.Z();
+    MESSAGE("Projected Vertex: " << x0 << ", " << y0 << ", " << z0);
+    coords.push_back(u0);
+    coords.push_back(v0);
+    coords.push_back(x0);
+    coords.push_back(y0);
+    coords.push_back(z0);
+  
+    int key = 0;
+    if (! FacesWithEnforcedVerteces.Contains(TopoDS::Face(GeomShape))) {
+      key = FacesWithEnforcedVerteces.Add(TopoDS::Face(GeomShape));
+    }
+    else {
+      key = FacesWithEnforcedVerteces.FindIndex(TopoDS::Face(GeomShape));
+    }
+    
+    if (FaceId2EnforcedVertexCoords.find(key) != FaceId2EnforcedVertexCoords.end()) {
+      MESSAGE("Map of enf. vertex has key " << key)
+      MESSAGE("Enf. vertex list size is: " << FaceId2EnforcedVertexCoords[key].size())
+      FaceId2EnforcedVertexCoords[key].insert(coords);
+      MESSAGE("New Enf. vertex list size is: " << FaceId2EnforcedVertexCoords[key].size())
+    }
+    else {
+      MESSAGE("Map of enf. vertex has not key " << key << ": creating it")
+      std::set< std::vector<double> > ens;
+      ens.insert(coords);
+      FaceId2EnforcedVertexCoords[key] = ens;
+    }
+  }
+}
 
+/////////////////////////////////////////////////////////
 void createAttractorOnFace(TopoDS_Shape GeomShape, std::string AttractorFunction)
 {
   MESSAGE("Attractor function: "<< AttractorFunction);
@@ -468,7 +514,7 @@ void createAttractorOnFace(TopoDS_Shape GeomShape, std::string AttractorFunction
   }
 
   // Get the (u,v) values of the attractor on the face
-  projectionPoint myPoint = getUV(TopoDS::Face(GeomShape),gp_XYZ(xa,ya,za));
+  projectionPoint myPoint = getProjectionPoint(TopoDS::Face(GeomShape),gp_XYZ(xa,ya,za));
   gp_XY uvPoint = myPoint.uv;
   gp_XYZ xyzPoint = myPoint.xyz;
   Standard_Real u0 = uvPoint.X();
@@ -568,9 +614,9 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, blsu
     // Standard Size Maps
     //
     MESSAGE("Setting a Size Map");
-    const BLSURFPlugin_Hypothesis::TSizeMap & sizeMaps = hyp->GetSizeMapEntries();
-    BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt;
-    for ( smIt = sizeMaps.begin(); smIt != sizeMaps.end(); ++smIt ) {
+    const BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = BLSURFPlugin_Hypothesis::GetSizeMapEntries(hyp);
+    BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
+    for ( ; smIt != sizeMaps.end(); ++smIt ) {
       if ( !smIt->second.empty() ) {
         MESSAGE("blsurf_set_sizeMap(): " << smIt->first << " = " << smIt->second);
         GeomShape = entryToShape(smIt->first);
@@ -667,9 +713,9 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, blsu
     // Attractors
     //
     MESSAGE("Setting Attractors");
-    const BLSURFPlugin_Hypothesis::TSizeMap & attractors = hyp->GetAttractorEntries();
-    BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt;
-    for ( atIt = attractors.begin(); atIt != attractors.end(); ++atIt ) {
+    const BLSURFPlugin_Hypothesis::TSizeMap attractors = BLSURFPlugin_Hypothesis::GetAttractorEntries(hyp);
+    BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
+    for ( ; atIt != attractors.end(); ++atIt ) {
       if ( !atIt->second.empty() ) {
         MESSAGE("blsurf_set_attractor(): " << atIt->first << " = " << atIt->second);
         GeomShape = entryToShape(atIt->first);
@@ -688,7 +734,6 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, blsu
           HasSizeMapOnFace = true;
           createAttractorOnFace(GeomShape, atIt->second);
         }
-
 /*
         if (GeomType == TopAbs_EDGE){
           HasSizeMapOnEdge = true;
@@ -706,6 +751,33 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, blsu
     }
 
 
+    //
+    // Enforced Verteces
+    //
+    MESSAGE("Setting Enforced Verteces");
+    const BLSURFPlugin_Hypothesis::TEnforcedVertexMap enforcedVertexMap = BLSURFPlugin_Hypothesis::GetAllEnforcedVerteces(hyp);
+    BLSURFPlugin_Hypothesis::TEnforcedVertexMap::const_iterator enfIt = enforcedVertexMap.begin();
+    for ( ; enfIt != enforcedVertexMap.end(); ++enfIt ) {
+      if ( !enfIt->second.empty() ) {
+        GeomShape = entryToShape(enfIt->first);
+        GeomType  = GeomShape.ShapeType();
+        // Group Management
+        if (GeomType == TopAbs_COMPOUND){
+          for (TopoDS_Iterator it (GeomShape); it.More(); it.Next()){
+            if (it.Value().ShapeType() == TopAbs_FACE){
+              HasSizeMapOnFace = true;
+              createEnforcedVertexOnFace(it.Value(), enfIt->second);
+            }
+          }
+        }
+            
+        if (GeomType == TopAbs_FACE){
+          HasSizeMapOnFace = true;
+          createEnforcedVertexOnFace(GeomShape, enfIt->second);
+        }
+      }
+    }
+
 //    if (HasSizeMapOnFace){
     // In all size map cases (hphy_flag = 2), at least map on face must be defined
     MESSAGE("Setting Size Map on FACES ");
@@ -823,8 +895,10 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape)
     }
     
     if (HasSizeMapOnFace){
+      std::cout << "A size map is defined on a face" << std::endl;
       // Classic size map
       faceKey = FacesWithSizeMap.FindIndex(f);
+      
       if (FaceId2SizeMap.find(faceKey)!=FaceId2SizeMap.end()){
         theSizeMapStr = FaceId2SizeMap[faceKey];
         // check if function ends with "return"
@@ -843,10 +917,10 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape)
       // Specific size map = Attractor
       std::map<int,std::vector<double> >::iterator attractor_iter = FaceId2AttractorCoords.begin();
       int iatt=0;
-      for ( ; attractor_iter != FaceId2AttractorCoords.end(); ++attractor_iter ) {
+      for (; attractor_iter != FaceId2AttractorCoords.end(); ++attractor_iter) {
         if (attractor_iter->first == faceKey) {
           MESSAGE("Face indice: " << iface);
-          MESSAGE("Adding enforced verteces");
+          MESSAGE("Adding attractor");
           
           double xyzCoords[3]  = {attractor_iter->second[2],
                                   attractor_iter->second[3],
@@ -879,6 +953,57 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape)
           FaceId2AttractorCoords.erase(faceKey);
         }
       }
+      
+      // Enforced Verteces
+      faceKey = FacesWithEnforcedVerteces.FindIndex(f);
+      std::map<int,std::set<std::vector<double> > >::const_iterator evmIt = FaceId2EnforcedVertexCoords.find(faceKey);
+      if (evmIt != FaceId2EnforcedVertexCoords.end()) {
+        std::cout << "Some enforced verteces are defined" << std::endl;
+        int ienf = 0;
+        std::set<std::vector<double> > evl;
+//         std::vector<double> ev;
+        MESSAGE("Face indice: " << iface);
+        MESSAGE("Adding enforced verteces");
+        evl = evmIt->second;
+        MESSAGE("Number of verteces to add: "<< evl.size())
+        std::set< std::vector<double> >::const_iterator evlIt = evl.begin();
+        for (; evlIt != evl.end(); ++evlIt) {
+//           ev = *evlIt;
+//         for (int i=0; i<evl.size() ; i++) {
+//           ev = evl[i];
+          
+//           double xyzCoords[3]  = {ev[2], ev[3], ev[4]};
+          double xyzCoords[3]  = {evlIt->at(0), evlIt->at(3), evlIt->at(4)};
+          MESSAGE("Check position of vertex =(" << xyzCoords[0] << "," << xyzCoords[1] << "," << xyzCoords[2] << ")");
+          gp_Pnt P(xyzCoords[0],xyzCoords[1],xyzCoords[2]);
+          BRepClass_FaceClassifier scl(f,P,1e-7);
+          // scl.Perform() is bugged. The function was rewritten
+//          scl.Perform();
+          BRepClass_FaceClassifierPerform(&scl,f,P,1e-7);
+          TopAbs_State result = scl.State();
+          MESSAGE("Position of point on face: "<<result);
+          if ( result == TopAbs_OUT )
+              MESSAGE("Point is out of face: node is not created");
+          if ( result == TopAbs_UNKNOWN )
+              MESSAGE("Point position on face is unknown: node is not created");
+          if ( result == TopAbs_ON )
+              MESSAGE("Point is on border of face: node is not created");
+          if ( result == TopAbs_IN )
+          {
+            // Point is inside face and not on border
+            MESSAGE("Point is in face: node is created");
+//             double uvCoords[2]   = {ev[0],ev[1]};
+            double uvCoords[2]   = {evlIt->at(0),evlIt->at(1)};
+            ienf++;
+            MESSAGE("Add cad point on (u,v)=(" << uvCoords[0] << "," << uvCoords[1] << ") with id = " << ienf);
+            cad_point_t* point_p = cad_point_new(fce, ienf, uvCoords);
+            cad_point_set_tag(point_p, ienf);
+          }
+        }
+        FaceId2EnforcedVertexCoords.erase(faceKey);
+      }
+      else
+        std::cout << "No enforced vertex defined" << std::endl;
     }
     
     
@@ -1141,6 +1266,8 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape)
   EdgesWithSizeMap.Statistics(std::cout);
   std::cout << "VertecesWithSizeMap" << std::endl;
   VertecesWithSizeMap.Statistics(std::cout);
+  std::cout << "FacesWithEnforcedVerteces" << std::endl;
+  FacesWithEnforcedVerteces.Statistics(std::cout);
   
   return true;
 }
index 92bb519a2d56bf4c1e1d73beda02197260387dcd..61fba537c9a245381b6efbded00f544e48c66770 100644 (file)
@@ -44,7 +44,10 @@ BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis (int hypId, int studyId,
     _gradation(GetDefaultGradation()),
     _quadAllowed(GetDefaultQuadAllowed()),
     _decimesh(GetDefaultDecimesh()),
-    _verb( GetDefaultVerbosity() )
+    _verb( GetDefaultVerbosity() ),
+    _sizeMap(GetDefaultSizeMap()),
+    _attractors(GetDefaultSizeMap()),
+    _enforcedVerteces(GetDefaultEnforcedVertexMap())
 {
   _name = "BLSURF_Parameters";
   _param_algo_dim = 2;
@@ -338,7 +341,9 @@ void BLSURFPlugin_Hypothesis::ClearOption(const std::string& optionName)
     op_val->second.clear();
 }
 
-
+//=======================================================================
+//function : SetSizeMapEntry
+//=======================================================================
 void  BLSURFPlugin_Hypothesis::SetSizeMapEntry(const std::string& entry,const std::string& sizeMap)
 {
   if (_sizeMap[entry].compare(sizeMap) != 0) {
@@ -347,6 +352,9 @@ void  BLSURFPlugin_Hypothesis::SetSizeMapEntry(const std::string& entry,const st
   }
 }
 
+//=======================================================================
+//function : GetSizeMapEntry
+//=======================================================================
 std::string  BLSURFPlugin_Hypothesis::GetSizeMapEntry(const std::string& entry)
 {
  TSizeMap::iterator it  = _sizeMap.find( entry );
@@ -356,6 +364,17 @@ std::string  BLSURFPlugin_Hypothesis::GetSizeMapEntry(const std::string& entry)
    return "No_Such_Entry";
 }
 
+  /*!
+   * \brief Return the size maps
+   */
+BLSURFPlugin_Hypothesis::TSizeMap BLSURFPlugin_Hypothesis::GetSizeMapEntries(const BLSURFPlugin_Hypothesis* hyp)
+{
+    return hyp ? hyp->_GetSizeMapEntries():GetDefaultSizeMap();
+}
+
+//=======================================================================
+//function : SetAttractorEntry
+//=======================================================================
 void  BLSURFPlugin_Hypothesis::SetAttractorEntry(const std::string& entry,const std::string& attractor)
 {
   if (_attractors[entry].compare(attractor) != 0) {
@@ -364,6 +383,9 @@ void  BLSURFPlugin_Hypothesis::SetAttractorEntry(const std::string& entry,const
   }
 }
 
+//=======================================================================
+//function : GetAttractorEntry
+//=======================================================================
 std::string  BLSURFPlugin_Hypothesis::GetAttractorEntry(const std::string& entry)
 {
  TSizeMap::iterator it  = _attractors.find( entry );
@@ -373,6 +395,15 @@ std::string  BLSURFPlugin_Hypothesis::GetAttractorEntry(const std::string& entry
    return "No_Such_Entry";
 }
 
+  /*!
+   * \brief Return the attractors
+   */
+BLSURFPlugin_Hypothesis::TSizeMap BLSURFPlugin_Hypothesis::GetAttractorEntries(const BLSURFPlugin_Hypothesis* hyp)
+{
+    return hyp ? hyp->_GetAttractorEntries():GetDefaultSizeMap();
+}
+
+
 
 void BLSURFPlugin_Hypothesis::ClearEntry(const std::string& entry)
 {
@@ -401,6 +432,174 @@ void BLSURFPlugin_Hypothesis::ClearSizeMaps()
 
 
 
+//=======================================================================
+//function : SetEnforcedVertex
+//=======================================================================
+
+void BLSURFPlugin_Hypothesis::SetEnforcedVertex(const std::string& entry, double x, double y, double z)
+{
+  BLSURFPlugin_Hypothesis::TEnforcedVertex coord;
+  coord.push_back(x);
+  coord.push_back(y);
+  coord.push_back(z);
+  bool toNotify = false;
+  if (_enforcedVerteces.count(entry)>0)
+    if (_enforcedVerteces[entry].count(coord)==0)
+      toNotify = true;
+  else
+    toNotify = true;
+  
+  _enforcedVerteces[entry].insert(coord);
+  if (toNotify)
+    NotifySubMeshesHypothesisModification();
+}
+
+/*
+//=======================================================================
+//function : SetEnforcedVertexList
+//=======================================================================
+
+void BLSURFPlugin_Hypothesis::SetEnforcedVertexList(const std::string& entry, const BLSURFPlugin_Hypothesis::TEnforcedVertexList vertexList)
+{
+  BLSURFPlugin_Hypothesis::TEnforcedVertexList::const_iterator it;
+  bool toNotify = false;
+  for(it = vertexList.begin();it!=vertexList.end();++it) {
+    if (_enforcedVerteces.count(entry)>0)
+      if (_enforcedVerteces[entry].count(*it)==0)
+        toNotify = true;
+    else
+      toNotify = true;
+    _enforcedVerteces[entry].insert(*it);
+  }
+  if (toNotify)
+    NotifySubMeshesHypothesisModification();
+}
+*/
+
+//=======================================================================
+//function : GetEnforcedVerteces
+//=======================================================================
+
+BLSURFPlugin_Hypothesis::TEnforcedVertexList BLSURFPlugin_Hypothesis::GetEnforcedVerteces(const std::string& entry)
+  throw (std::invalid_argument)
+{
+  if (_enforcedVerteces.count(entry)>0)
+    return _enforcedVerteces[entry];
+  std::ostringstream msg ;
+  msg << "No enforced vertex for entry " << entry ;
+  throw std::invalid_argument(msg.str());
+}
+
+//=======================================================================
+//function : ClearEnforcedVertex
+//=======================================================================
+
+void BLSURFPlugin_Hypothesis::ClearEnforcedVertex(const std::string& entry, double x, double y, double z)
+  throw (std::invalid_argument)
+{
+  BLSURFPlugin_Hypothesis::TEnforcedVertex coord;
+  coord.push_back(x);
+  coord.push_back(y);
+  coord.push_back(z);
+  BLSURFPlugin_Hypothesis::TEnforcedVertexList::iterator it;
+  bool toNotify = false;
+
+  BLSURFPlugin_Hypothesis::TEnforcedVertexMap::iterator it_enf = _enforcedVerteces.find(entry);
+  if (it_enf != _enforcedVerteces.end()) {
+    it = _enforcedVerteces[entry].find(coord);
+    if (it != _enforcedVerteces[entry].end()) {
+      toNotify = true;
+      _enforcedVerteces[entry].erase(it);
+      if (_enforcedVerteces[entry].size() == 0)
+        _enforcedVerteces.erase(it_enf);
+    }
+    if (toNotify)
+      NotifySubMeshesHypothesisModification();
+    return;
+  }
+
+  std::ostringstream msg ;
+  msg << "No enforced vertex for " << entry;
+  throw std::invalid_argument(msg.str());
+}
+/*
+//=======================================================================
+//function : ClearEnforcedVertexList
+//=======================================================================
+
+void BLSURFPlugin_Hypothesis::ClearEnforcedVertexList(const std::string& entry, BLSURFPlugin_Hypothesis::TEnforcedVertexList vertexList)
+  throw (std::invalid_argument)
+{
+  BLSURFPlugin_Hypothesis::TEnforcedVertex coord;
+  BLSURFPlugin_Hypothesis::TEnforcedVertexList::const_iterator it_toRemove;
+  BLSURFPlugin_Hypothesis::TEnforcedVertexList::iterator it;
+  bool toNotify = false;
+
+  BLSURFPlugin_Hypothesis::TEnforcedVertexMap::iterator it_enf = _enforcedVerteces.find(entry);
+  if (it_enf != _enforcedVerteces.end()) {
+    for (it_toRemove = vertexList.begin() ; it_toRemove != vertexList.end() ; ++it_toRemove) {
+      coord = *it_toRemove;
+      it = _enforcedVerteces[entry].find(coord);
+      if (it != _enforcedVerteces[entry].end()) {
+        toNotify = true;
+        _enforcedVerteces[entry].erase(it);
+      }
+    }
+    if (_enforcedVerteces[entry].size() == 0) {
+      toNotify = true;
+      _enforcedVerteces.erase(it_enf);
+    }
+    if (toNotify)
+      NotifySubMeshesHypothesisModification();
+    return;
+  }
+
+  std::ostringstream msg ;
+  msg << "No enforced vertex for " << entry;
+  throw std::invalid_argument(msg.str());
+}
+*/
+//=======================================================================
+//function : ClearEnforcedVerteces
+//=======================================================================
+
+void BLSURFPlugin_Hypothesis::ClearEnforcedVerteces(const std::string& entry)
+  throw (std::invalid_argument)
+{
+  BLSURFPlugin_Hypothesis::TEnforcedVertexMap::iterator it_enf = _enforcedVerteces.find(entry);
+  if (it_enf != _enforcedVerteces.end()) {
+    _enforcedVerteces.erase(it_enf);
+    NotifySubMeshesHypothesisModification();
+    return;
+  }
+
+  std::ostringstream msg ;
+  msg << "No enforced vertex for " << entry;
+  throw std::invalid_argument(msg.str());
+}
+
+//=======================================================================
+//function : ClearAllEnforcedVerteces
+//=======================================================================
+void BLSURFPlugin_Hypothesis::ClearAllEnforcedVerteces()
+{
+    _enforcedVerteces.clear();
+    NotifySubMeshesHypothesisModification();
+}
+
+//================================================================================
+/*!
+* \brief Return the enforced verteces
+*/
+//================================================================================
+
+BLSURFPlugin_Hypothesis::TEnforcedVertexMap BLSURFPlugin_Hypothesis::GetAllEnforcedVerteces(const BLSURFPlugin_Hypothesis* hyp)
+{
+    return hyp ? hyp->_GetAllEnforcedVerteces():GetDefaultEnforcedVertexMap();
+}
+
+
+
 //=============================================================================
 std::ostream & BLSURFPlugin_Hypothesis::SaveTo(std::ostream & save)
 {
index de5af169f83168846dc585318dd0637646b8c869..59231f6458f0056797c5b822747f509d48aab682 100644 (file)
@@ -27,6 +27,7 @@
 #define _BLSURFPlugin_Hypothesis_HXX_
 
 #include "SMESH_Hypothesis.hxx"
+#include <vector>
 #include <map>
 #include <set>
 #include <stdexcept>
@@ -98,18 +99,26 @@ public:
   int GetVerbosity() const { return _verb; }
   
   void ClearEntry(const std::string& entry);
-  void ClearSizeMaps();  
+  void ClearSizeMaps();
 
   typedef std::map<std::string,std::string> TSizeMap;
 
   void SetSizeMapEntry(const std::string& entry,const std::string& sizeMap );
   std::string  GetSizeMapEntry(const std::string& entry);
-  const TSizeMap& GetSizeMapEntries() const { return _sizeMap; }  
+  const TSizeMap& _GetSizeMapEntries() const { return _sizeMap; }
+  /*!
+   * \brief Return the size maps
+   */
+  static TSizeMap GetSizeMapEntries(const BLSURFPlugin_Hypothesis* hyp);
 
 
   void SetAttractorEntry(const std::string& entry,const std::string& attractor );
   std::string GetAttractorEntry(const std::string& entry);
-  const TSizeMap& GetAttractorEntries() const { return _attractors; };
+  const TSizeMap& _GetAttractorEntries() const { return _attractors; };
+  /*!
+   * \brief Return the attractors
+   */
+  static TSizeMap GetAttractorEntries(const BLSURFPlugin_Hypothesis* hyp);
 
 
 /*
@@ -119,18 +128,43 @@ public:
   const TSizeMap& GetCustomSizeMapEntries() const { return _customSizeMap; }
  */
 
-  static Topology      GetDefaultTopology();
-  static PhysicalMesh  GetDefaultPhysicalMesh();
-  static double        GetDefaultPhySize();
-  static double        GetDefaultMaxSize();
-  static double        GetDefaultMinSize();
-  static GeometricMesh GetDefaultGeometricMesh();
-  static double        GetDefaultAngleMeshS();
-  static double        GetDefaultAngleMeshC() { return GetDefaultAngleMeshS(); }
-  static double        GetDefaultGradation();
-  static bool          GetDefaultQuadAllowed();
-  static bool          GetDefaultDecimesh();
-  static int           GetDefaultVerbosity() { return 10; }
+  /*!
+   * To set/get/unset an enforced vertex
+   */
+  typedef std::vector<double> TEnforcedVertex;
+  typedef std::set< TEnforcedVertex > TEnforcedVertexList;
+  typedef std::map< std::string, TEnforcedVertexList > TEnforcedVertexMap;
+  
+  void SetEnforcedVertex(const std::string& entry, double x, double y, double z);
+//   void SetEnforcedVertexList(const std::string& entry, const TEnforcedVertexList vertexList);
+  TEnforcedVertexList GetEnforcedVerteces(const std::string& entry) throw (std::invalid_argument);
+  void ClearEnforcedVertex(const std::string& entry, double x, double y, double z) throw (std::invalid_argument);
+//   void ClearEnforcedVertexList(const std::string& entry, TEnforcedVertexList vertexList) throw (std::invalid_argument);
+  void ClearEnforcedVerteces(const std::string& entry) throw (std::invalid_argument);
+
+  void ClearAllEnforcedVerteces();
+  const TEnforcedVertexMap _GetAllEnforcedVerteces() const { return _enforcedVerteces; }
+
+  /*!
+   * \brief Return the enforced verteces
+   */
+  static TEnforcedVertexMap GetAllEnforcedVerteces(const BLSURFPlugin_Hypothesis* hyp);
+
+
+  static Topology        GetDefaultTopology();
+  static PhysicalMesh    GetDefaultPhysicalMesh();
+  static double          GetDefaultPhySize();
+  static double          GetDefaultMaxSize();
+  static double          GetDefaultMinSize();
+  static GeometricMesh   GetDefaultGeometricMesh();
+  static double          GetDefaultAngleMeshS();
+  static double          GetDefaultAngleMeshC() { return GetDefaultAngleMeshS(); }
+  static double          GetDefaultGradation();
+  static bool            GetDefaultQuadAllowed();
+  static bool            GetDefaultDecimesh();
+  static int             GetDefaultVerbosity() { return 10; }
+  static TSizeMap        GetDefaultSizeMap() { return TSizeMap();}
+  static TEnforcedVertexMap GetDefaultEnforcedVertexMap() { return TEnforcedVertexMap(); }
 
   static double undefinedDouble() { return -1.0; }
 
@@ -164,19 +198,20 @@ public:
   virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
 
 private:
-  Topology      _topology;
-  PhysicalMesh  _physicalMesh;
-  double        _phySize, _phyMin, _phyMax;
-  GeometricMesh _geometricMesh;
-  double        _angleMeshS, _angleMeshC, _hgeoMin, _hgeoMax;
-  double        _gradation;
-  bool          _quadAllowed;
-  bool          _decimesh;
-  int           _verb;
-  TOptionValues _option2value;
-  TOptionNames  _doubleOptions, _charOptions;
-  TSizeMap      _sizeMap;
-  TSizeMap      _attractors;
+  Topology        _topology;
+  PhysicalMesh    _physicalMesh;
+  double          _phySize, _phyMin, _phyMax;
+  GeometricMesh   _geometricMesh;
+  double          _angleMeshS, _angleMeshC, _hgeoMin, _hgeoMax;
+  double          _gradation;
+  bool            _quadAllowed;
+  bool            _decimesh;
+  int             _verb;
+  TOptionValues   _option2value;
+  TOptionNames    _doubleOptions, _charOptions;
+  TSizeMap        _sizeMap;
+  TSizeMap        _attractors;
+  TEnforcedVertexMap _enforcedVerteces;
 /*
   TSizeMap      _customSizeMap;
 */
index da746c51b660e9884a7eddb3855e9a48a7ed739a..9541fad2ce685527af6d3243a340ffa28d466120 100644 (file)
@@ -576,7 +576,7 @@ void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry,const char*
 
 
 //=============================================================================
-                                                             
+
 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) 
   throw (SALOME::SALOME_Exception)
 {
@@ -637,7 +637,7 @@ BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries()
   ASSERT(myBaseImpl);
   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
 
-  const ::BLSURFPlugin_Hypothesis::TSizeMap & sizeMaps= this->GetImpl()->GetSizeMapEntries();
+  const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps= this->GetImpl()->_GetSizeMapEntries();
   result->length( sizeMaps.size() );
 
   ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
@@ -659,7 +659,7 @@ BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries()
   ASSERT(myBaseImpl);
   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
 
-  const ::BLSURFPlugin_Hypothesis::TSizeMap & attractors= this->GetImpl()->GetAttractorEntries();
+  const ::BLSURFPlugin_Hypothesis::TSizeMap attractors= this->GetImpl()->_GetAttractorEntries();
   result->length( attractors.size() );
 
   ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
@@ -780,7 +780,280 @@ BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
 
 */
 
-     
+
+///////////////////////
+// ENFORCED VERTEXES //
+///////////////////////
+
+BLSURFPlugin::TEnforcedVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerteces()
+{
+  ASSERT(myBaseImpl);
+  BLSURFPlugin::TEnforcedVertexMap_var resultMap = new BLSURFPlugin::TEnforcedVertexMap();
+  const ::BLSURFPlugin_Hypothesis::TEnforcedVertexMap enforcedVertexMap = this->GetImpl()->_GetAllEnforcedVerteces();
+  resultMap->length(enforcedVertexMap.size());
+
+  ::BLSURFPlugin_Hypothesis::TEnforcedVertexList enforcedVertexList;
+  ::BLSURFPlugin_Hypothesis::TEnforcedVertexMap::const_iterator evmIt = enforcedVertexMap.begin();
+  for ( int i = 0 ; evmIt != enforcedVertexMap.end(); ++evmIt, ++i ) {
+    string entry = evmIt->first;
+    enforcedVertexList = evmIt->second;
+
+    BLSURFPlugin::TEnforcedVertexMapElement_var mapElement = new BLSURFPlugin::TEnforcedVertexMapElement();
+
+    BLSURFPlugin::TEnforcedVertexList_var vertexList = new BLSURFPlugin::TEnforcedVertexList();
+    vertexList->length(enforcedVertexList.size());
+
+    ::BLSURFPlugin_Hypothesis::TEnforcedVertexList::const_iterator evlIt = enforcedVertexList.begin();
+    for ( int j = 0 ; evlIt != enforcedVertexList.end(); ++evlIt, ++j ) {
+      BLSURFPlugin::TEnforcedVertex_var enforcedVertex = new BLSURFPlugin::TEnforcedVertex();
+      enforcedVertex[0] = (*evlIt)[0];
+      enforcedVertex[1] = (*evlIt)[1];
+      enforcedVertex[2] = (*evlIt)[2];
+      vertexList[j] = enforcedVertex;
+    }
+
+    mapElement->entry = CORBA::string_dup(entry.c_str());
+    mapElement->vertexList = vertexList;
+
+    resultMap[i] = mapElement;
+
+  }
+  return resultMap._retn();
+}
+
+void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVerteces()
+{
+  ASSERT(myBaseImpl);
+  this->GetImpl()->ClearAllEnforcedVerteces();
+  SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVerteces()";
+}
+
+/*!
+  * Set/get/unset an enforced vertex on geom object
+  */
+void BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr GeomObj, CORBA::Double x, CORBA::Double y, CORBA::Double z)
+  throw (SALOME::SALOME_Exception)
+{
+  ASSERT(myBaseImpl);
+  // TODO check that GeomObj is a face => in engine ?
+  string entry = GeomObj->GetStudyEntry();
+  MESSAGE("IDL : GetName : " << GeomObj->GetName());
+  MESSAGE("IDL : SetEnforcedVertex ( "<< entry << ", " << x << ", " << y << ", " << z << ")");
+  try {
+    SetEnforcedVertexEntry(entry.c_str(), x, y, z);
+  }
+  catch (SALOME_Exception& ex) {
+    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+  }
+}
+
+
+BLSURFPlugin::TEnforcedVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerteces(GEOM::GEOM_Object_ptr GeomObj)
+  throw (SALOME::SALOME_Exception)
+{
+  ASSERT(myBaseImpl);
+  string entry = GeomObj->GetStudyEntry();
+  MESSAGE("IDL : GetName : " << GeomObj->GetName());
+  MESSAGE("IDL : GetEnforcedVertexList ( "<< entry << ")");
+  try {
+    return GetEnforcedVertecesEntry(entry.c_str());
+  }
+  catch (SALOME_Exception& ex) {
+    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+  }
+}
+
+
+void BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr GeomObj, CORBA::Double x, CORBA::Double y, CORBA::Double z)
+  throw (SALOME::SALOME_Exception)
+{
+  ASSERT(myBaseImpl);
+  string entry = GeomObj->GetStudyEntry();
+  MESSAGE("IDL : GetName : " << GeomObj->GetName());
+  MESSAGE("IDL : UnsetEnforcedVertex ( "<< entry << ", " << x << ", " << y << ", " << z << ")");
+
+  try {
+    UnsetEnforcedVertexEntry(entry.c_str(), x, y, z);
+  }
+  catch (SALOME_Exception& ex) {
+    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+  }
+}
+
+
+void BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerteces(GEOM::GEOM_Object_ptr GeomObj)
+  throw (SALOME::SALOME_Exception)
+{
+  ASSERT(myBaseImpl);;
+  string entry = GeomObj->GetStudyEntry();
+  MESSAGE("IDL : GetName : " << GeomObj->GetName());
+  MESSAGE("IDL : UnsetEnforcedVerteces ( "<< entry << ")");
+
+  try {
+    UnsetEnforcedVertecesEntry(entry.c_str());
+  }
+  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
+  */
+void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* entry, double x, double y, double z)
+  throw (SALOME::SALOME_Exception)
+{
+  ASSERT(myBaseImpl);
+  MESSAGE("IDL : SETENFORCEDVERTEX START - ENTRY: " << entry << " VERTEX: " << x << " " << y << " " << z);
+  bool newValue = false;
+  
+  try {
+    ::BLSURFPlugin_Hypothesis::TEnforcedVertexList vertexList = this->GetImpl()->GetEnforcedVerteces(entry);
+    ::BLSURFPlugin_Hypothesis::TEnforcedVertex vertex;
+    vertex.push_back(x);
+    vertex.push_back(y);
+    vertex.push_back(z);
+    if (vertexList.find(vertex) == vertexList.end()) {
+      MESSAGE("Vertex not found: add it in vertexList")
+      newValue = true;
+    }
+    else
+      MESSAGE("Vertex already found")
+  }
+  catch (const std::invalid_argument& ex) {
+    // no enforced vertex for entry
+    MESSAGE("Entry not found : add it to the list")
+    newValue = true;
+  }
+  catch (SALOME_Exception& ex) {
+    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+  }
+  
+  if ( newValue ) {
+    this->GetImpl()->SetEnforcedVertex(entry, x, y, z);
+    SMESH::TPythonDump() << _this() << ".SetEnforcedVertex("
+                         << entry << ", "
+                         << x << ", "
+                         << y << ", "
+                         << z << ")";
+  }
+  MESSAGE("IDL : SETENFORCEDVERTEX END - ENTRY: " << entry);
+}
+/*
+void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexListEntry(const char* entry, BLSURFPlugin::TEnforcedVertexList& vertexList)
+  throw (SALOME::SALOME_Exception)
+{
+  ASSERT(myBaseImpl);
+}
+*/
+
+BLSURFPlugin::TEnforcedVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertecesEntry(const char* entry)
+  throw (SALOME::SALOME_Exception)
+{
+  ASSERT(myBaseImpl);
+  MESSAGE("ENGINE : GETENFORCEDVERTECES START ENTRY : " << entry);
+  
+  try {
+    BLSURFPlugin::TEnforcedVertexList_var vertexList = new BLSURFPlugin::TEnforcedVertexList();
+    ::BLSURFPlugin_Hypothesis::TEnforcedVertexList _vList = this->GetImpl()->GetEnforcedVerteces(entry);
+    vertexList->length(_vList.size());
+    MESSAGE("Number of enforced verteces: " << _vList.size());
+    ::BLSURFPlugin_Hypothesis::TEnforcedVertexList::const_iterator evlIt = _vList.begin();
+    for ( int i = 0; evlIt != _vList.end() ; ++evlIt, ++i ) {
+      BLSURFPlugin::TEnforcedVertex_var enforcedVertex = new BLSURFPlugin::TEnforcedVertex();
+      enforcedVertex->length(3);
+      MESSAGE("Enforced vertex #" << i << ": "<< (*evlIt)[0] << ", " << (*evlIt)[1] << ", " << (*evlIt)[2]);
+      enforcedVertex[0] = (*evlIt)[0];
+      enforcedVertex[1] = (*evlIt)[1];
+      enforcedVertex[2] = (*evlIt)[2];
+      vertexList[i] = enforcedVertex;
+    }
+    return vertexList._retn();
+  }
+  catch (const std::invalid_argument& ex) {
+    SALOME::ExceptionStruct ExDescription;
+    ExDescription.text = ex.what();
+    ExDescription.type = SALOME::BAD_PARAM;
+    ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertecesEntry(entry)";
+    ExDescription.lineNumber = 945;
+    throw SALOME::SALOME_Exception(ExDescription);
+  }
+  catch(const std::exception& ex) {
+    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+  }
+
+  MESSAGE("ENGINE : GETENFORCEDVERTECES END ENTRY : " << entry);
+}
+
+
+void BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* entry, CORBA::Double x, CORBA::Double y, CORBA::Double z)
+  throw (SALOME::SALOME_Exception)
+{
+  ASSERT(myBaseImpl);
+  MESSAGE("ENGINE : UNSETENFORCEDVERTEX START ENTRY : " << entry);
+  
+  try {
+    this->GetImpl()->ClearEnforcedVertex(entry, x, y, z);
+    SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertex("
+                         << entry << ", "
+                         << x << ", "
+                         << y << ", "
+                         << z << ")";
+  }
+  catch (const std::invalid_argument& ex) {
+    SALOME::ExceptionStruct ExDescription;
+    ExDescription.text = ex.what();
+    ExDescription.type = SALOME::BAD_PARAM;
+    ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(entry,x,y,z)";
+    ExDescription.lineNumber = 1003;
+    throw SALOME::SALOME_Exception(ExDescription);
+  }
+  catch(const std::exception& ex) {
+    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+  }
+
+  MESSAGE("ENGINE : UNSETENFORCEDVERTEX END ENTRY : " << entry);
+}
+/*
+void BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexListEntry(const char* entry, BLSURFPlugin::TEnforcedVertexList& vertexList)
+  throw (SALOME::SALOME_Exception)
+{
+  ASSERT(myBaseImpl);
+}
+*/
+void BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertecesEntry(const char* entry)
+  throw (SALOME::SALOME_Exception)
+{
+  ASSERT(myBaseImpl);
+  MESSAGE("ENGINE : UNSETENFORCEDVERTECES START ENTRY : " << entry);
+  
+  try {
+    this->GetImpl()->ClearEnforcedVerteces(entry);
+    SMESH::TPythonDump() << _this() << ".UnsetEnforcedVerteces(" << entry << ")";
+  }
+  catch (const std::invalid_argument& ex) {
+    SALOME::ExceptionStruct ExDescription;
+    ExDescription.text = ex.what();
+    ExDescription.type = SALOME::BAD_PARAM;
+    ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertecesEntry(entry)";
+    ExDescription.lineNumber = 1051;
+    throw SALOME::SALOME_Exception(ExDescription);
+  }
+  catch(const std::exception& ex) {
+    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+  }
+
+  MESSAGE("ENGINE : UNSETENFORCEDVERTECES END ENTRY : " << entry);
+}
+
+
+///////////////////////
+
+
+
+
+
 //=============================================================================
 /*!
  *  BLSURFPlugin_Hypothesis_i::GetImpl
index eef96171d292c34f8d1f680d83e1de7203fa2354..d161116fb2ea38340ab88d249091b2542047be5c 100644 (file)
@@ -140,9 +140,37 @@ class BLSURFPlugin_Hypothesis_i:
   BLSURFPlugin::string_array* GetCustomSizeMapEntries();
 */
 
+  ///////////////////////
+  // ENFORCED VERTEXES //
+  ///////////////////////
+  
+  BLSURFPlugin::TEnforcedVertexMap* GetAllEnforcedVerteces();
+  void                              ClearAllEnforcedVerteces();
+
+  /*!
+    * Set/get/unset an enforced vertex on geom object
+    */
+  void         SetEnforcedVertex(GEOM::GEOM_Object_ptr GeomObj, CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception);
+//   void         SetEnforcedVertexList(GEOM::GEOM_Object_ptr GeomObj, const BLSURFPlugin::TEnforcedVertexList& vertexList) throw (SALOME::SALOME_Exception);
+  BLSURFPlugin::TEnforcedVertexList* GetEnforcedVerteces(GEOM::GEOM_Object_ptr GeomObj) throw (SALOME::SALOME_Exception);
+  void         UnsetEnforcedVertex(GEOM::GEOM_Object_ptr GeomObj, CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception);
+//   void         UnsetEnforcedVertexList(GEOM::GEOM_Object_ptr GeomObj, BLSURFPlugin::TEnforcedVertexList& vertexList) throw (SALOME::SALOME_Exception);
+  void         UnsetEnforcedVerteces(GEOM::GEOM_Object_ptr GeomObj) throw (SALOME::SALOME_Exception);
+
+  /*!
+    * Set/get/unset an enforced vertex on geom object given by entry
+    */
+  void         SetEnforcedVertexEntry(const char* entry, double x, double y, double z) throw (SALOME::SALOME_Exception);
+//   void         SetEnforcedVertexListEntry(const char* entry, BLSURFPlugin::TEnforcedVertexList& vertexList) throw (SALOME::SALOME_Exception);
+  BLSURFPlugin::TEnforcedVertexList* GetEnforcedVertecesEntry(const char* entry) throw (SALOME::SALOME_Exception);
+  void         UnsetEnforcedVertexEntry(const char* entry, CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception);
+//   void         UnsetEnforcedVertexListEntry(const char* entry, BLSURFPlugin::TEnforcedVertexList& vertexList) throw (SALOME::SALOME_Exception);
+  void         UnsetEnforcedVertecesEntry(const char* entry) throw (SALOME::SALOME_Exception);
+  ///////////////////////
+
   // Get implementation
   ::BLSURFPlugin_Hypothesis* GetImpl();
-  
+
   // Verify whether hypothesis supports given entity type 
   CORBA::Boolean IsDimSupported( SMESH::Dimension type );
 };