]> SALOME platform Git repositories - plugins/blsurfplugin.git/commitdiff
Salome HOME
Adding periodicity to BLSURF plugin.
authorbourcier <bourcier>
Thu, 25 Jul 2013 13:44:55 +0000 (13:44 +0000)
committerbourcier <bourcier>
Thu, 25 Jul 2013 13:44:55 +0000 (13:44 +0000)
Merge from BR_periodicity.

idl/BLSURFPlugin_Algorithm.idl
resources/BLSURFPlugin.xml
src/BLSURFPlugin/BLSURFPluginBuilder.py
src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx
src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx

index c03c31ca50c200dddc3c7608b7c428b89b3d9d27..0549426c596eb008acdb52cb08ed8787a72decc6 100644 (file)
@@ -426,6 +426,20 @@ module BLSURFPlugin
 //    TFaceEntryInternalVerticesList GetAllInternalEnforcedVerticesFaces();
     ///////////////////////
     
+
+    ///////////////////////
+    // PERIODICITY       //
+    ///////////////////////
+
+    void AddPreCadFacesPeriodicity(in GEOM::GEOM_Object faces1, in GEOM::GEOM_Object faces2, in string f_transf) raises (SALOME::SALOME_Exception);
+    void AddPreCadEdgesPeriodicity(in GEOM::GEOM_Object edges1, in GEOM::GEOM_Object edges2, in string f_transf) raises (SALOME::SALOME_Exception);
+    void AddFacePeriodicity(in GEOM::GEOM_Object face1, in GEOM::GEOM_Object face2) raises (SALOME::SALOME_Exception);
+    void AddEdgePeriodicity(in GEOM::GEOM_Object face1, in GEOM::GEOM_Object edge1, in GEOM::GEOM_Object face2, in GEOM::GEOM_Object edge2, in long edge_orientation) raises (SALOME::SALOME_Exception);
+    void AddEdgePeriodicityWithoutFaces(in GEOM::GEOM_Object edge1, in GEOM::GEOM_Object edge2, in long edge_orientation) raises (SALOME::SALOME_Exception);
+    void AddVertexPeriodicity(in GEOM::GEOM_Object edge1, in GEOM::GEOM_Object Vertex1, in GEOM::GEOM_Object edge2, in GEOM::GEOM_Object vertex2) raises (SALOME::SALOME_Exception);
+    
+    ///////////////////////
+
     /*!
      * Sets the file for export resulting mesh in GMF format
      */
index d62773003fe139f2292477c43612d09f594fbcae..54615e2ec2cb275f76c4a36787c5320d9d5dde57 100644 (file)
@@ -55,7 +55,8 @@
           SetEnforcedVertexGeomWithGroup,
           UnsetEnforcedVertex,
           UnsetEnforcedVertexGeom,
-          UnsetEnforcedVertices
+          UnsetEnforcedVertices,
+          AddPreCadFacesPeriodicity
         </accumulative-methods>
       </python-wrap>
     </hypothesis>
index 60bffad999665dc173c835df52f864905e7e0eaf..ca8aa42b7fe53a71e5eb894bbee4395a6c32f044 100644 (file)
@@ -424,6 +424,78 @@ class BLSURF_Algorithm(Mesh_Algorithm):
       pass
     return self.params
 
+  #-----------------------------------------
+  # Periodicity (BLSURF)
+  #-----------------------------------------
+  
+  ## Defines periodicity between two groups of faces
+  #  @param faces1: group of faces to associate with faces2
+  #  @param faces2: group of faces associated with faces1
+  #  @param f_transf (optionnal): the transformation function from faces1 to faces2.
+  #                               If None, PreCAD tries to find a simple translation
+
+  def AddPreCadFacesPeriodicity(self, faces1, faces2, f_transf= ""):
+      """calls preCad function:
+      status_t cad_add_face_multiple_periodicity_with_transformation_function(cad t *cad,
+            integer *fid1, integer size1, integer *fid2, integer size2,
+            periodicity_transformation_t transf, void *user data);
+      """
+      self.Parameters().AddPreCadFacesPeriodicity(faces1, faces2, f_transf)
+      pass
+
+  ## Defines periodicity between two groups of edges
+  #  @param edges1: group of edges to associate with edges2
+  #  @param edges2: group of edges associated with edges1
+  #  @param f_transf (optionnal): the transformation function from edges1 to edges2.
+  #                               If None, PreCAD tries to find a simple translation
+
+  def AddPreCadEdgesPeriodicity(self, edges1, edges2, f_transf= ""):
+      """calls preCad function:
+      status_t cad_add_edge_multiple_periodicity_with_transformation_function(cad t *cad,
+            integer *eid1, integer size1, integer *eid2, integer size2,
+            periodicity_transformation_t transf, void *user data);
+      """
+      self.Parameters().AddPreCadEdgesPeriodicity(edges1, edges2, f_transf)
+      pass
+
+  ## Defines periodicity between two groups of faces.
+  # This macro defines periodicity with the CADSurf API on each sub face, sub edge and sub vertex.
+  # PreCAD is not needed.
+  #  @param faces1: group of faces to associate with faces2
+  #  @param faces2: group of faces associated with faces1
+  #  @param f_transf: the transformation function from faces1 to faces2.
+  def AddAdvancedFacesPeriodicity(faces1, faces2, f_transf):
+      self.Parameters().AddAdvancedFacesPeriodicity(faces1, faces2, f_transf)
+      pass
+      
+
+  ## Defines periodicity between two faces
+  # User has to call AddEdgePeriodicity with the edges of the face
+  # and AddVertexPeriodicity with the vertices of each edge
+  def AddFacePeriodicity(self, face1, face2):
+      self.Parameters().AddFacePeriodicity(face1, face2)
+      pass
+      
+  ## Defines periodicity between two edges belonging to two periodic faces
+  # @param edge_orientation: -1 (reversed), 0 (unknown) or 1 (forward)
+  # User has to call AddVertexPeriodicity with the vertices of each edge
+  def AddEdgePeriodicity(self, face1, edge1, face2, edge2, edge_orientation=0):
+      self.Parameters().AddEdgePeriodicity(face1, edge1, face2, edge2, edge_orientation)
+      pass
+
+  ## Defines periodicity between two edges without face periodicity
+  # @param edge_orientation: -1 (reversed), 0 (unknown) or 1 (forward)
+  # User has to call AddVertexPeriodicity with the vertices of each edge
+  def AddEdgePeriodicityWithoutFaces(self, edge1, edge2, edge_orientation=0):
+      self.Parameters().AddEdgePeriodicityWithoutFaces(edge1, edge2, edge_orientation)
+      pass
+      
+  ## Defines periodicity between two vertices
+  def AddVertexPeriodicity(self, edge1, vertex1, edge2, vertex2):
+      self.Parameters().AddVertexPeriodicity(edge1, vertex1, edge2, vertex2)
+      pass
+
+
   #=====================
   # Obsolete methods
   #=====================
index 41ce9764803ce4a09cce32fa8084a00446c9ae68..721cb861478460b22ac45758b76010c4c10c8ad3 100644 (file)
@@ -689,6 +689,190 @@ void createAttractorOnFace(TopoDS_Shape GeomShape, std::string AttractorFunction
 //     MESSAGE("point OK");
 }
 
+// One sub-shape to get ids from
+BLSURFPlugin_BLSURF::TListOfIDs _getSubShapeIDsInMainShape(TopoDS_Shape theMainShape, TopoDS_Shape theSubShape,
+    TopAbs_ShapeEnum theShapeType)
+{
+  BLSURFPlugin_BLSURF::TListOfIDs face_ids;
+  TopTools_IndexedMapOfShape anIndices;
+  anIndices.Clear();
+  TopExp::MapShapes(theMainShape, theShapeType, anIndices);
+
+//  Standard_Boolean result = BRepTools::Write(theMainShape,"main_shape.brep");
+
+  for (TopExp_Explorer face_iter(theSubShape,theShapeType);face_iter.More();face_iter.Next())
+    {
+      int face_id = anIndices.FindIndex(face_iter.Current());
+      if (face_id == 0)
+        throw SALOME_Exception ( SMESH_Comment("Sub_shape not found in main_shape"));
+      face_ids.push_back(face_id);
+//      std::ostringstream o;
+//      o << "face_" << face_id << ".brep";
+//      std::string face_name = o.str();
+//      const TopoDS_Face& face = TopoDS::Face(face_iter.Current());
+//      Standard_Boolean result = BRepTools::Write(face,face_name.c_str());
+    }
+
+  return face_ids;
+}
+
+
+/////////////////////////////////////////////////////////
+void BLSURFPlugin_BLSURF::createPreCadFacesPeriodicity(TopoDS_Shape theGeomShape, BLSURFPlugin_Hypothesis::TEntry faces1,
+    BLSURFPlugin_Hypothesis::TEntry faces2, const char* f_funct)
+{
+  MESSAGE("BLSURFPlugin_BLSURF::createFacesPeriodicity");
+
+  TopoDS_Shape geomShape1 = entryToShape(faces1);
+  TopoDS_Shape geomShape2 = entryToShape(faces2);
+
+  TListOfIDs faces1_ids = _getSubShapeIDsInMainShape(theGeomShape, geomShape1, TopAbs_FACE);
+  TListOfIDs faces2_ids = _getSubShapeIDsInMainShape(theGeomShape, geomShape2, TopAbs_FACE);
+
+  TPreCadPeriodicityIDs preCaDFacesPeriodicityIDs;
+  preCaDFacesPeriodicityIDs.shape1IDs = faces1_ids;
+  preCaDFacesPeriodicityIDs.shape2IDs = faces2_ids;
+  preCaDFacesPeriodicityIDs.f_funct = f_funct;
+
+
+  _preCadFacesIDsPeriodicityVector.push_back(preCaDFacesPeriodicityIDs);
+  MESSAGE("_preCadFacesIDsPeriodicityVector.size() = " << _preCadFacesIDsPeriodicityVector.size());
+  MESSAGE("BLSURFPlugin_BLSURF::createFacesPeriodicity END");
+
+}
+
+/////////////////////////////////////////////////////////
+void BLSURFPlugin_BLSURF::createPreCadEdgesPeriodicity(TopoDS_Shape theGeomShape, BLSURFPlugin_Hypothesis::TEntry edges1,
+    BLSURFPlugin_Hypothesis::TEntry edges2, const char* f_funct)
+{
+  MESSAGE("BLSURFPlugin_BLSURF::createEdgesPeriodicity");
+
+  TopoDS_Shape geomShape1 = entryToShape(edges1);
+  TopoDS_Shape geomShape2 = entryToShape(edges2);
+
+  TListOfIDs edges1_ids = _getSubShapeIDsInMainShape(theGeomShape, geomShape1, TopAbs_EDGE);
+  TListOfIDs edges2_ids = _getSubShapeIDsInMainShape(theGeomShape, geomShape2, TopAbs_EDGE);
+
+  TPreCadPeriodicityIDs preCaDEdgesPeriodicityIDs;
+  preCaDEdgesPeriodicityIDs.shape1IDs = edges1_ids;
+  preCaDEdgesPeriodicityIDs.shape2IDs = edges2_ids;
+  preCaDEdgesPeriodicityIDs.f_funct = f_funct;
+
+
+  _preCadEdgesIDsPeriodicityVector.push_back(preCaDEdgesPeriodicityIDs);
+  MESSAGE("_preCadEdgesIDsPeriodicityVector.size() = " << _preCadEdgesIDsPeriodicityVector.size());
+  MESSAGE("BLSURFPlugin_BLSURF::createEdgesPeriodicity END");
+
+}
+
+/////////////////////////////////////////////////////////
+void BLSURFPlugin_BLSURF::createFacesPeriodicity(TopoDS_Shape theGeomShape, BLSURFPlugin_Hypothesis::TEntry face1,  BLSURFPlugin_Hypothesis::TEntry face2)
+{
+  MESSAGE("BLSURFPlugin_BLSURF::createFacesPeriodicity");
+
+  TopoDS_Shape GeomShape1 = entryToShape(face1);
+  TopoDS_Shape GeomShape2 = entryToShape(face2);
+
+  TListOfIDs faces1_ids = _getSubShapeIDsInMainShape(theGeomShape, GeomShape1, TopAbs_FACE);
+  TListOfIDs faces2_ids = _getSubShapeIDsInMainShape(theGeomShape, GeomShape2, TopAbs_FACE);
+
+  // Only one face id, since only a face can be selected
+  int face1_id = faces1_ids[0];
+  int face2_id = faces2_ids[0];
+
+  std::pair<int, int> pairOfFacesID = std::make_pair(face1_id, face2_id);
+
+  _facesIDsPeriodicityVector.push_back(pairOfFacesID);
+  MESSAGE("_facesIDsPeriodicityVector.size() = " << _facesIDsPeriodicityVector.size());
+  MESSAGE("BLSURFPlugin_BLSURF::createFacesPeriodicity END");
+
+}
+
+
+/////////////////////////////////////////////////////////
+void BLSURFPlugin_BLSURF::createEdgesPeriodicity(TopoDS_Shape theGeomShape, BLSURFPlugin_Hypothesis::TEntry face1, BLSURFPlugin_Hypothesis::TEntry edge1,
+    BLSURFPlugin_Hypothesis::TEntry face2, BLSURFPlugin_Hypothesis::TEntry edge2, int edge_orientation)
+{
+  MESSAGE("BLSURFPlugin_BLSURF::createEdgesPeriodicity");
+
+  TEdgePeriodicityIDs edgePeriodicityIDs;
+
+  if (face1 != "")
+    {
+      TopoDS_Shape GeomFace1 = entryToShape(face1);
+      TListOfIDs faces1_ids = _getSubShapeIDsInMainShape(theGeomShape, GeomFace1, TopAbs_FACE);
+      // Only one face id, since only a face can be selected
+      edgePeriodicityIDs.face1ID = faces1_ids[0];
+    }
+  else
+    edgePeriodicityIDs.face1ID = 0;
+  if (face2 != "")
+    {
+      TopoDS_Shape GeomFace2 = entryToShape(face2);
+      TListOfIDs faces2_ids = _getSubShapeIDsInMainShape(theGeomShape, GeomFace2, TopAbs_FACE);
+      edgePeriodicityIDs.face2ID = faces2_ids[0];
+    }
+  else
+    edgePeriodicityIDs.face2ID = 0;
+
+  TopoDS_Shape GeomEdge1 = entryToShape(edge1);
+  TopoDS_Shape GeomEdge2 = entryToShape(edge2);
+
+  TListOfIDs edges1_ids = _getSubShapeIDsInMainShape(theGeomShape, GeomEdge1, TopAbs_EDGE);
+  TListOfIDs edges2_ids = _getSubShapeIDsInMainShape(theGeomShape, GeomEdge2, TopAbs_EDGE);
+
+  if (edge_orientation == 0 and GeomEdge1.Closed())
+    {
+      // if edge is closed, we have to set its orientation
+      MESSAGE("GeomEdge1.Orientation() = " << GeomEdge1.Orientation());
+      MESSAGE("GeomEdge2.Orientation() = " << GeomEdge2.Orientation());
+      if(GeomEdge1.Orientation() == TopAbs_FORWARD)
+        edge_orientation = CAD_ORIENTATION_REVERSED;
+      else
+        edge_orientation = CAD_ORIENTATION_FORWARD;
+    }
+
+  // Only one edge id, since only a edge can be selected
+  edgePeriodicityIDs.edge1ID = edges1_ids[0];
+  edgePeriodicityIDs.edge2ID = edges2_ids[0];
+  edgePeriodicityIDs.edge_orientation = edge_orientation;
+
+  _edgesIDsPeriodicityVector.push_back(edgePeriodicityIDs);
+  MESSAGE("_edgesIDsPeriodicityVector.size() = " << _edgesIDsPeriodicityVector.size());
+  MESSAGE("BLSURFPlugin_BLSURF::createEdgesPeriodicity END");
+
+}
+
+
+/////////////////////////////////////////////////////////
+void BLSURFPlugin_BLSURF::createVerticesPeriodicity(TopoDS_Shape theGeomShape, BLSURFPlugin_Hypothesis::TEntry edge1, BLSURFPlugin_Hypothesis::TEntry vertex1,
+    BLSURFPlugin_Hypothesis::TEntry edge2, BLSURFPlugin_Hypothesis::TEntry vertex2)
+{
+  MESSAGE("BLSURFPlugin_BLSURF::createVerticesPeriodicity");
+
+  TopoDS_Shape GeomEdge1 = entryToShape(edge1);
+  TopoDS_Shape GeomVertex1 = entryToShape(vertex1);
+  TopoDS_Shape GeomEdge2 = entryToShape(edge2);
+  TopoDS_Shape GeomVertex2 = entryToShape(vertex2);
+
+  TListOfIDs edges1_ids = _getSubShapeIDsInMainShape(theGeomShape, GeomEdge1, TopAbs_EDGE);
+  TListOfIDs vertices1_ids = _getSubShapeIDsInMainShape(theGeomShape, GeomVertex1, TopAbs_VERTEX);
+  TListOfIDs edges2_ids = _getSubShapeIDsInMainShape(theGeomShape, GeomEdge2, TopAbs_EDGE);
+  TListOfIDs vertices2_ids = _getSubShapeIDsInMainShape(theGeomShape, GeomVertex2, TopAbs_VERTEX);
+
+  // Only one vertex id, since only a vertex can be selected
+  TVertexPeriodicityIDs vertexPeriodicityIDs;
+  vertexPeriodicityIDs.edge1ID = edges1_ids[0];
+  vertexPeriodicityIDs.vertex1ID = vertices1_ids[0];
+  vertexPeriodicityIDs.edge2ID = edges2_ids[0];
+  vertexPeriodicityIDs.vertex2ID = vertices2_ids[0];
+
+  _verticesIDsPeriodicityVector.push_back(vertexPeriodicityIDs);
+  MESSAGE("_verticesIDsPeriodicityVector.size() = " << _verticesIDsPeriodicityVector.size());
+  MESSAGE("BLSURFPlugin_BLSURF::createVerticesPeriodicity END");
+
+}
+
 /////////////////////////////////////////////////////////
 
 void BLSURFPlugin_BLSURF::SetParameters(
@@ -1199,6 +1383,64 @@ void BLSURFPlugin_BLSURF::SetParameters(
 // #endif
     }
   }
+
+  // PERIODICITY
+  MESSAGE("SetParameters preCadFacesPeriodicityVector");
+  const BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadFacesPeriodicityVector = BLSURFPlugin_Hypothesis::GetPreCadFacesPeriodicityVector(hyp);
+
+  for (std::size_t i = 0; i<preCadFacesPeriodicityVector.size(); i++){
+    MESSAGE("SetParameters preCadFacesPeriodicityVector[" << i << "]");
+    createPreCadFacesPeriodicity(theGeomShape, preCadFacesPeriodicityVector[i].shape1Entry, preCadFacesPeriodicityVector[i].shape2Entry, preCadFacesPeriodicityVector[i].f_funct);
+  }
+  MESSAGE("_preCadFacesIDsPeriodicityVector.size() = " << _preCadFacesIDsPeriodicityVector.size());
+
+  MESSAGE("SetParameters preCadEdgesPeriodicityVector");
+  const BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadEdgesPeriodicityVector = BLSURFPlugin_Hypothesis::GetPreCadEdgesPeriodicityVector(hyp);
+
+  for (std::size_t i = 0; i<preCadEdgesPeriodicityVector.size(); i++){
+    MESSAGE("SetParameters preCadEdgesPeriodicityVector[" << i << "]");
+    createPreCadEdgesPeriodicity(theGeomShape, preCadEdgesPeriodicityVector[i].shape1Entry, preCadEdgesPeriodicityVector[i].shape2Entry, preCadEdgesPeriodicityVector[i].f_funct);
+  }
+  MESSAGE("_preCadEdgesIDsPeriodicityVector.size() = " << _preCadEdgesIDsPeriodicityVector.size());
+
+  if ( _preCadFacesIDsPeriodicityVector.size() > 0 or _preCadEdgesIDsPeriodicityVector.size() > 0 )
+    {
+      MESSAGE("USING PRECAD FOR PERIODICITY")
+      *use_precad = true;
+      precad_set_param(pcs, "verbose",                to_string(_verb).c_str());
+    }
+
+  MESSAGE("SetParameters facesPeriodicityVector");
+  const BLSURFPlugin_Hypothesis::TFacesPeriodicityVector facesPeriodicityVector = BLSURFPlugin_Hypothesis::GetFacesPeriodicityVector(hyp);
+
+  for (std::size_t i = 0; i<facesPeriodicityVector.size(); i++){
+    MESSAGE("SetParameters facesPeriodicityVector[" << i << "]");
+    createFacesPeriodicity(theGeomShape, facesPeriodicityVector[i].first, facesPeriodicityVector[i].second);
+  }
+  MESSAGE("_facesIDsPeriodicityVector.size() = " << _facesIDsPeriodicityVector.size());
+
+
+  MESSAGE("SetParameters edgesPeriodicityVector");
+  const BLSURFPlugin_Hypothesis::TEdgesPeriodicityVector edgesPeriodicityVector = BLSURFPlugin_Hypothesis::GetEdgesPeriodicityVector(hyp);
+
+  for (std::size_t i = 0; i<edgesPeriodicityVector.size(); i++){
+    MESSAGE("SetParameters edgesPeriodicityVector[" << i << "]");
+    // TODO: passer directement en paramètre edgesPeriodicityVector[i] plutôt que tous ces attributs
+    createEdgesPeriodicity(theGeomShape, edgesPeriodicityVector[i].face1Entry, edgesPeriodicityVector[i].edge1Entry,
+        edgesPeriodicityVector[i].face2Entry, edgesPeriodicityVector[i].edge2Entry, edgesPeriodicityVector[i].edge_orientation);
+  }
+  MESSAGE("_edgesIDsPeriodicityVector.size() = " << _edgesIDsPeriodicityVector.size());
+
+  MESSAGE("SetParameters verticesPeriodicityVector");
+  const BLSURFPlugin_Hypothesis::TVerticesPeriodicityVector verticesPeriodicityVector = BLSURFPlugin_Hypothesis::GetVerticesPeriodicityVector(hyp);
+
+  for (std::size_t i = 0; i<verticesPeriodicityVector.size(); i++){
+    MESSAGE("SetParameters verticesPeriodicityVector[" << i << "]");
+    // TODO: passer directement en paramètre verticesPeriodicityVector[i] plutôt que tous ces attributs
+    createVerticesPeriodicity(theGeomShape, verticesPeriodicityVector[i].edge1Entry, verticesPeriodicityVector[i].vertex1Entry,
+        verticesPeriodicityVector[i].edge2Entry, verticesPeriodicityVector[i].vertex2Entry);
+  }
+  MESSAGE("_verticesIDsPeriodicityVector.size() = " << _verticesIDsPeriodicityVector.size());
 }
 
 //================================================================================
@@ -1240,15 +1482,21 @@ namespace
     cadsurf_session_t* _css;
     cad_t *           _cad;
     dcad_t *          _dcad;
+    cad_t *           _cleanc;
+    dcad_t *          _cleandc;
   public:
     BLSURF_Cleaner(context_t *       ctx,
                    cadsurf_session_t* css,
                    cad_t *           cad,
-                   dcad_t *          dcad)
+                   dcad_t *          dcad,
+                   cad_t *           cleanc,
+                   dcad_t *          cleandc)
       : _ctx ( ctx  ),
         _css ( css  ),
         _cad ( cad  ),
-        _dcad( dcad )
+        _dcad( dcad ),
+        _cleanc( cleanc ),
+        _cleandc( cleandc )
     {
     }
     ~BLSURF_Cleaner()
@@ -1287,6 +1535,8 @@ namespace
 
         cad_delete(_cad); _cad = 0;
         dcad_delete(_dcad); _dcad = 0;
+        cad_delete(_cleanc); _cleanc = 0;
+        dcad_delete(_cleandc); _cleandc = 0;
         if ( !exceptContext )
         {
           context_delete(_ctx); _ctx = 0;
@@ -1688,13 +1938,16 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh&         aMesh,
   // PreCAD
   // If user requests it, send the CAD through Distene preprocessor : PreCAD
   cad_t *cleanc = NULL; // preprocessed cad
+  dcad_t *cleandc = NULL; // preprocessed dcad
   precad_session_t *pcs = precad_session_new(ctx);
+  // Give both dcad and cad to precad
+  precad_data_set_dcad(pcs, dcad);
   precad_data_set_cad(pcs, c);
 
   cadsurf_session_t *css = cadsurf_session_new(ctx);
 
   // an object that correctly deletes all cadsurf objects at destruction
-  BLSURF_Cleaner cleaner( ctx,css,c,dcad );
+  BLSURF_Cleaner cleaner( ctx,css,c,dcad,cleanc,cleandc );
 
   MESSAGE("BEGIN SetParameters");
   bool use_precad = false;
@@ -1705,6 +1958,8 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh&         aMesh,
                 _hypothesis, css, pcs, aShape, &use_precad);
   MESSAGE("END SetParameters");
 
+  MESSAGE("_preCadFacesIDsPeriodicityVector.size() = " << _preCadFacesIDsPeriodicityVector.size());
+
   haveQuadraticSubMesh = haveQuadraticSubMesh || (_hypothesis != NULL && _hypothesis->GetQuadraticMesh());
   helper.SetIsQuadratic( haveQuadraticSubMesh );
 
@@ -1756,6 +2011,10 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh&         aMesh,
     if (fmap.FindIndex(f) > 0)
       continue;
     iface = fmap.Add(f);
+    std::string aFileName = "fmap_face_";
+    aFileName.append(to_string(iface));
+    aFileName.append(".brep");
+    BRepTools::Write(f,aFileName.c_str());
 
     surfaces.push_back(BRep_Tool::Surface(f));
 
@@ -1947,6 +2206,11 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh&         aMesh,
       if (ic <= 0)
         ic = emap.Add(e);
 
+      std::string aFileName = "fmap_edge_";
+      aFileName.append(to_string(ic));
+      aFileName.append(".brep");
+      BRepTools::Write(e,aFileName.c_str());
+
       double tmin,tmax;
       curves.push_back(BRep_Tool::CurveOnSurface(e, f, tmin, tmax));
 
@@ -2072,6 +2336,12 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh&         aMesh,
           if ( sm->IsMeshComputed() )
             edgeSubmeshes.insert( sm->GetSubMeshDS() );
         }
+
+        std::string aFileName = "fmap_vertex_";
+        aFileName.append(to_string(*ip));
+        aFileName.append(".brep");
+        BRepTools::Write(v,aFileName.c_str());
+
         if (HasSizeMapOnVertex){
           vertexKey = VerticesWithSizeMap.FindIndex(v);
           if (VertexId2SizeMap.find(vertexKey)!=VertexId2SizeMap.end()){
@@ -2140,8 +2410,150 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh&         aMesh,
     }
   }
 
+  ///////////////////////
+  // PERIODICITY       //
+  ///////////////////////
+
+  MESSAGE("BEFORE PERIODICITY");
+  MESSAGE("_preCadFacesIDsPeriodicityVector.size() = " << _preCadFacesIDsPeriodicityVector.size());
+  if (! _preCadFacesIDsPeriodicityVector.empty()){
+    MESSAGE("INTO PRECAD FACES PERIODICITY");
+    for (std::size_t i=0; i < _preCadFacesIDsPeriodicityVector.size(); i++){
+      std::vector<int> faces1_ids = _preCadFacesIDsPeriodicityVector[i].shape1IDs;
+      std::vector<int> faces2_ids = _preCadFacesIDsPeriodicityVector[i].shape2IDs;
+      // TODO: récupérer _preCadFacesIDsPeriodicityVector[i].f_funct
+      meshgems_cad_periodicity_transformation_t periodicity_transformation = NULL;
+      int* faces1_ids_c = &faces1_ids[0];
+      int* faces2_ids_c = &faces2_ids[0];
+      std::ostringstream o;
+      o << "_preCadFacesIDsPeriodicityVector[" << i << "] = [";
+      for (std::size_t j=0; j < faces1_ids.size(); j++)
+        o << faces1_ids[j] << ", ";
+      o << "], [";
+      for (std::size_t j=0; j < faces2_ids.size(); j++)
+        o << faces2_ids[j] << ", ";
+      o << "]";
+      MESSAGE(o.str());
+      MESSAGE("faces1_ids.size(): " << faces1_ids.size());
+      MESSAGE("faces2_ids.size(): " << faces2_ids.size());
+      status = cad_add_face_multiple_periodicity_with_transformation_function(c, faces1_ids_c, faces1_ids.size(),
+          faces2_ids_c, faces2_ids.size(), periodicity_transformation, NULL);
+//      double p1[] = {0, 0, 0, 100, 0, 0, 0, 0, 100};
+//      double p2[] = {0, 100, 0, 100, 100, 0, 0, 100, 100};
+//      double (*ptr1)[9];
+//      double (*ptr2)[9];
+//      ptr1 = &p1;
+//      ptr2 = &p2;
+//      status = cad_add_face_multiple_periodicity_with_transformation_function_by_points(c, faces1_ids_c, faces1_ids.size(),
+//          faces2_ids_c, faces2_ids.size(), &p1[0], 3, &p2[0], 3);
+      if(status != STATUS_OK){
+        cout << "cad_add_face_multiple_periodicity_with_transformation_function failed with error code " << status << "\n";
+      }
+    }
+
+    MESSAGE("END PRECAD FACES PERIODICITY");
+  }
+
+  MESSAGE("_preCadEdgesIDsPeriodicityVector.size() = " << _preCadEdgesIDsPeriodicityVector.size());
+  if (! _preCadEdgesIDsPeriodicityVector.empty()){
+    MESSAGE("INTO PRECAD EDGES PERIODICITY");
+    for (std::size_t i=0; i < _preCadEdgesIDsPeriodicityVector.size(); i++){
+      // TODO: plutôt que d'utiliser une paire edge1, edge2, utiliser un struct avec edge1, edge2 et f_transf
+      std::vector<int> edges1_ids = _preCadEdgesIDsPeriodicityVector[i].shape1IDs;
+      std::vector<int> edges2_ids = _preCadEdgesIDsPeriodicityVector[i].shape2IDs;
+      // TODO: récupérer _preCadEdgesIDsPeriodicityVector[i].f_funct
+      meshgems_cad_periodicity_transformation_t periodicity_transformation = NULL;
+      // Use the address of the first element of the vector to initialise the array
+//      int* edges1_ids_c = &edges1_ids[0];
+//      int* edges2_ids_c = &edges2_ids[0];
+
+      // Copy the vector into an array
+      int edges1_ids_c[edges1_ids.size()];
+      std::copy(edges1_ids.begin(), edges1_ids.end(), edges1_ids_c);
+      int edges2_ids_c[edges2_ids.size()];
+      std::copy(edges2_ids.begin(), edges2_ids.end(), edges2_ids_c);
+
+      std::ostringstream o;
+      o << "_preCadEdgesIDsPeriodicityVector[" << i << "] = [";
+      for (std::size_t j=0; j < edges1_ids.size(); j++)
+        o << edges1_ids[j] << ", ";
+      o << "], [";
+      for (std::size_t j=0; j < edges2_ids.size(); j++)
+        o << edges2_ids[j] << ", ";
+      o << "]";
+      MESSAGE(o.str());
+      MESSAGE("edges1_ids.size(): " << edges1_ids.size());
+      MESSAGE("edges2_ids.size(): " << edges2_ids.size());
+      status = cad_add_edge_multiple_periodicity_with_transformation_function(c, edges1_ids_c, edges1_ids.size(),
+          edges2_ids_c, edges2_ids.size(), periodicity_transformation, NULL);
+//      double p1[] = {0, 0, 0, 100, 0, 0, 0, 0, 100};
+//      double p2[] = {0, 100, 0, 100, 100, 0, 0, 100, 100};
+//      double (*ptr1)[9];
+//      double (*ptr2)[9];
+//      ptr1 = &p1;
+//      ptr2 = &p2;
+//      status = cad_add_edge_multiple_periodicity_with_transformation_function_by_points(c, edges1_ids_c, edges1_ids.size(),
+//          edges2_ids_c, edges2_ids.size(), &p1[0], 3, &p2[0], 3);
+      if(status != STATUS_OK){
+        cout << "cad_add_edge_multiple_periodicity_with_transformation_function failed with error code " << status << "\n";
+      }
+    }
+
+    MESSAGE("END PRECAD EDGES PERIODICITY");
+  }
+
+  if (! _facesIDsPeriodicityVector.empty()){
+    MESSAGE("INTO FACE PERIODICITY");
+    for (std::size_t i=0; i < _facesIDsPeriodicityVector.size(); i++){
+      int face1 = _facesIDsPeriodicityVector[i].first;
+      int face2 = _facesIDsPeriodicityVector[i].second;
+      MESSAGE("_facesIDsPeriodicityVector[" << i << "] = (" << face1 << ", " << face2 << ")");
+      status = cad_add_face_periodicity(c, face1, face2);
+      if(status != STATUS_OK){
+        cout << "cad_add_face_periodicity failed with error code " << status << "\n";
+      }
+    }
+    MESSAGE("END FACE PERIODICITY");
+  }
+
+
+  if (! _edgesIDsPeriodicityVector.empty()){
+    MESSAGE("INTO EDGE PERIODICITY");
+    for (std::size_t i=0; i < _edgesIDsPeriodicityVector.size(); i++){
+      int face1 = _edgesIDsPeriodicityVector[i].face1ID;
+      int edge1 = _edgesIDsPeriodicityVector[i].edge1ID;
+      int face2 = _edgesIDsPeriodicityVector[i].face2ID;
+      int edge2 = _edgesIDsPeriodicityVector[i].edge2ID;
+      int edge_orientation = _edgesIDsPeriodicityVector[i].edge_orientation;
+      MESSAGE("_edgesIDsPeriodicityVector[" << i << "] = (" << face1 << ", " << edge1 << ", " << face2 << ", " << edge2 << ", " << edge_orientation << ")");
+      status = cad_add_edge_periodicity(c, face1, edge1, face2, edge2, edge_orientation);
+      if(status != STATUS_OK){
+        cout << "cad_add_edge_periodicity failed with error code " << status << "\n";
+      }
+    }
+    MESSAGE("END EDGE PERIODICITY");
+  }
+
+  if (! _verticesIDsPeriodicityVector.empty()){
+    MESSAGE("INTO VERTEX PERIODICITY");
+    for (std::size_t i=0; i < _verticesIDsPeriodicityVector.size(); i++){
+      int edge1 = _verticesIDsPeriodicityVector[i].edge1ID;
+      int vertex1 = _verticesIDsPeriodicityVector[i].vertex1ID;
+      int edge2 = _verticesIDsPeriodicityVector[i].edge2ID;
+      int vertex2 = _verticesIDsPeriodicityVector[i].vertex2ID;
+      MESSAGE("_verticesIDsPeriodicityVector[" << i << "] = (" << edge1 << ", " << vertex1 << ", " << edge2 << ", " << vertex2 << ")");
+      status = cad_add_point_periodicity(c, edge1, vertex1, edge2, vertex2);
+      if(status != STATUS_OK){
+        cout << "cad_add_vertex_periodicity failed with error code " << status << "\n";
+      }
+    }
+    MESSAGE("END VERTEX PERIODICITY");
+  }
+
+    ////
 
   if (use_precad) {
+    MESSAGE("use_precad");
     /* Now launch the PreCAD process */
     status = precad_process(pcs);
     if(status != STATUS_OK){
@@ -2149,11 +2561,22 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh&         aMesh,
     }
     else {
       // retrieve the pre-processed CAD object
+
+      // dcad
+      cleandc = precad_new_dcad(pcs);
+      if(!cleandc){
+        cout << "Unable to retrieve PreCAD result on dcad \n";
+      }
+      else
+        cout << "PreCAD processing successfull on dcad \n";
+
+      // cad
       cleanc = precad_new_cad(pcs);
       if(!cleanc){
-        cout << "Unable to retrieve PreCAD result \n";
+        cout << "Unable to retrieve PreCAD result on cad \n";
       }
-      cout << "PreCAD processing successfull \n";
+      else
+        cout << "PreCAD processing successfull on cad \n";
 
       // #if BLSURF_VERSION_LONG >= "3.1.1"
       //       /* We can now get the updated sizemaps (if any) */
@@ -2177,9 +2600,18 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh&         aMesh,
     precad_session_delete(pcs);
   }
 
-  cadsurf_data_set_dcad(css, dcad);
+  if (cleandc) {
+    cout << "Give the pre-processed dcad object to the current BLSurf session \n";
+    cadsurf_data_set_dcad(css, cleandc);
+  }
+  else {
+    // Use the original one
+    cadsurf_data_set_dcad(css, dcad);
+  }
+
   if (cleanc) {
     // Give the pre-processed CAD object to the current BLSurf session
+    cout << "Give the pre-processed CAD object to the current BLSurf session \n";
     cadsurf_data_set_cad(css, cleanc);
   }
   else {
index 5ebbd56019fd7d96767b08a272b3e57384c0bc3e..8e667bf515ab206e0b3133fa556a9095d6dbad3c 100644 (file)
@@ -94,10 +94,55 @@ class BLSURFPlugin_BLSURF: public SMESH_2D_Algo {
     virtual bool Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape,
                           MapShapeNbElems& aResMap);
 
+    // List of ids
+    typedef std::vector<int> TListOfIDs;
+
+    // PreCad Edges periodicity
+    struct TPreCadPeriodicityIDs {
+      TListOfIDs shape1IDs;
+      TListOfIDs shape2IDs;
+      const char* f_funct;
+    };
+
+    // Edge periodicity
+    struct TEdgePeriodicityIDs {
+      int face1ID;
+      int edge1ID;
+      int face2ID;
+      int edge2ID;
+      int edge_orientation;
+    };
+
+    // Vertex periodicity
+    struct TVertexPeriodicityIDs {
+      int edge1ID;
+      int vertex1ID;
+      int edge2ID;
+      int vertex2ID;
+    };
+
+    // pair of shapes
+    typedef std::pair<TopoDS_Shape, TopoDS_Shape> TPairOfShapes;
+    typedef std::pair<TListOfIDs, TListOfIDs> TPairOfListOfIDs;
+    // Vector of pairs of ids
+    typedef std::vector< TPreCadPeriodicityIDs > TPreCadIDsPeriodicityVector;
+    typedef std::vector< std::pair<int, int> > TShapesIDsPeriodicityVector;
+    typedef std::vector< TEdgePeriodicityIDs > TEdgesIDsPeriodicityVector;
+    typedef std::vector< TVertexPeriodicityIDs > TVerticesIDsPeriodicityVector;
+
+
+
   protected:
     const BLSURFPlugin_Hypothesis* _hypothesis;
     bool                           _haveViscousLayers;
 
+    TPreCadIDsPeriodicityVector _preCadFacesIDsPeriodicityVector;
+    TPreCadIDsPeriodicityVector _preCadEdgesIDsPeriodicityVector;
+
+    TShapesIDsPeriodicityVector _facesIDsPeriodicityVector;
+    TEdgesIDsPeriodicityVector _edgesIDsPeriodicityVector;
+    TVerticesIDsPeriodicityVector _verticesIDsPeriodicityVector;
+
   private:
     bool compute(SMESH_Mesh&          aMesh,
                  const TopoDS_Shape&  aShape);
@@ -108,6 +153,13 @@ class BLSURFPlugin_BLSURF: public SMESH_2D_Algo {
 
     TopoDS_Shape entryToShape(std::string entry);
     void createEnforcedVertexOnFace(TopoDS_Shape FaceShape, BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList);
+    void createPreCadFacesPeriodicity(TopoDS_Shape theGeomShape, BLSURFPlugin_Hypothesis::TEntry faces1,  BLSURFPlugin_Hypothesis::TEntry faces2, const char* f_funct = "");
+    void createPreCadEdgesPeriodicity(TopoDS_Shape theGeomShape, BLSURFPlugin_Hypothesis::TEntry edges1,  BLSURFPlugin_Hypothesis::TEntry edges2, const char* f_funct = "");
+    void createFacesPeriodicity(TopoDS_Shape theGeomShape, BLSURFPlugin_Hypothesis::TEntry face1,  BLSURFPlugin_Hypothesis::TEntry face2);
+    void createEdgesPeriodicity(TopoDS_Shape theGeomShape, BLSURFPlugin_Hypothesis::TEntry face1, BLSURFPlugin_Hypothesis::TEntry edge1,
+        BLSURFPlugin_Hypothesis::TEntry face2, BLSURFPlugin_Hypothesis::TEntry edge2, int edge_orientation = 0);
+    void createVerticesPeriodicity(TopoDS_Shape theGeomShape, BLSURFPlugin_Hypothesis::TEntry edge1, BLSURFPlugin_Hypothesis::TEntry vertex1,
+        BLSURFPlugin_Hypothesis::TEntry edge2, BLSURFPlugin_Hypothesis::TEntry vertex2);
     void Set_NodeOnEdge(SMESHDS_Mesh* meshDS, SMDS_MeshNode* node, const TopoDS_Shape& ed);
     void BRepClass_FaceClassifierPerform(BRepClass_FaceClassifier* fc, const TopoDS_Face& face, const gp_Pnt& P, const Standard_Real Tol);
 
index 172b8988f164a257b448cb565e846494c3aad5f5..211173002ce589302774d0ca6049b0e6e3c189a8 100644 (file)
@@ -78,7 +78,9 @@ BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_G
   _enfVertexEntryEnfVertexMap(GetDefaultEnfVertexEntryEnfVertexMap()),
   _groupNameNodeIDMap(GetDefaultGroupNameNodeIDMap()),
   _GMFFileName(GetDefaultGMFFile()),
-  _enforcedInternalVerticesAllFaces(GetDefaultInternalEnforcedVertex())
+  _enforcedInternalVerticesAllFaces(GetDefaultInternalEnforcedVertex()),
+  _preCadFacesPeriodicityVector(GetDefaultPreCadFacesPeriodicityVector()),
+  _preCadEdgesPeriodicityVector(GetDefaultPreCadEdgesPeriodicityVector())
 {
   _name = "BLSURF_Parameters";
   _param_algo_dim = 2;
@@ -1203,6 +1205,137 @@ void BLSURFPlugin_Hypothesis::SetInternalEnforcedVertexAllFacesGroup(BLSURFPlugi
   }
 }
 
+//=============================================================================
+BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector BLSURFPlugin_Hypothesis::GetPreCadFacesPeriodicityVector(
+    const BLSURFPlugin_Hypothesis* hyp) {
+  return hyp ? hyp->_GetPreCadFacesPeriodicityVector() : GetDefaultPreCadFacesPeriodicityVector();
+}
+
+//=============================================================================
+BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector BLSURFPlugin_Hypothesis::GetPreCadEdgesPeriodicityVector(
+    const BLSURFPlugin_Hypothesis* hyp) {
+  return hyp ? hyp->_GetPreCadEdgesPeriodicityVector() : GetDefaultPreCadEdgesPeriodicityVector();
+}
+
+//=============================================================================
+BLSURFPlugin_Hypothesis::TFacesPeriodicityVector BLSURFPlugin_Hypothesis::GetFacesPeriodicityVector(
+    const BLSURFPlugin_Hypothesis* hyp) {
+  return hyp ? hyp->_GetFacesPeriodicityVector() : GetDefaultFacesPeriodicityVector();
+}
+
+//=============================================================================
+BLSURFPlugin_Hypothesis::TEdgesPeriodicityVector BLSURFPlugin_Hypothesis::GetEdgesPeriodicityVector(
+    const BLSURFPlugin_Hypothesis* hyp){
+  return hyp ? hyp->_GetEdgesPeriodicityVector() : GetDefaultEdgesPeriodicityVector();
+}
+
+//=============================================================================
+BLSURFPlugin_Hypothesis::TVerticesPeriodicityVector BLSURFPlugin_Hypothesis::GetVerticesPeriodicityVector(
+    const BLSURFPlugin_Hypothesis* hyp){
+  return hyp ? hyp->_GetVerticesPeriodicityVector() : GetDefaultVerticesPeriodicityVector();
+}
+
+//=======================================================================
+//function : AddPreCadFacesPeriodicity
+//=======================================================================
+void BLSURFPlugin_Hypothesis::AddPreCadFacesPeriodicity(TEntry faces1Entry, TEntry faces2Entry, const char* f_funct) {
+
+  MESSAGE("BLSURFPlugin_Hypothesis::AddPreCadFacesPeriodicity("<< faces1Entry << ", "
+      << faces2Entry << ", " << f_funct << ")");
+
+  TPreCadPeriodicity preCadFacesPeriodicity;
+  preCadFacesPeriodicity.shape1Entry = faces1Entry;
+  preCadFacesPeriodicity.shape2Entry = faces2Entry;
+  preCadFacesPeriodicity.f_funct = f_funct;
+
+  _preCadFacesPeriodicityVector.push_back(preCadFacesPeriodicity);
+
+  NotifySubMeshesHypothesisModification();
+
+  MESSAGE("BLSURFPlugin_Hypothesis::AddPreCadFacesPeriodicity END");
+}
+
+//=======================================================================
+//function : AddPreCadEdgesPeriodicity
+//=======================================================================
+void BLSURFPlugin_Hypothesis::AddPreCadEdgesPeriodicity(TEntry edges1Entry, TEntry edges2Entry, const char* f_funct) {
+
+  MESSAGE("BLSURFPlugin_Hypothesis::AddPreCadEdgesPeriodicity("<< edges1Entry << ", "
+      << edges2Entry << ", " << f_funct << ")");
+
+  TPreCadPeriodicity preCadEdgesPeriodicity;
+  preCadEdgesPeriodicity.shape1Entry = edges1Entry;
+  preCadEdgesPeriodicity.shape2Entry = edges2Entry;
+  preCadEdgesPeriodicity.f_funct = f_funct;
+
+  _preCadEdgesPeriodicityVector.push_back(preCadEdgesPeriodicity);
+
+  NotifySubMeshesHypothesisModification();
+
+  MESSAGE("BLSURFPlugin_Hypothesis::AddPreCadEdgesPeriodicity END");
+}
+
+//=======================================================================
+//function : AddFacePeriodicity
+//=======================================================================
+void BLSURFPlugin_Hypothesis::AddFacePeriodicity(TEntry face1Entry, TEntry face2Entry) {
+
+  MESSAGE("BLSURFPlugin_Hypothesis::AddFacePeriodicity("<< face1Entry << ", "
+      << face2Entry << ")");
+
+  std::pair< TEntry, TEntry > pairOfFacesEntries = std::make_pair(face1Entry, face2Entry);
+
+  _facesPeriodicityVector.push_back(pairOfFacesEntries);
+
+  NotifySubMeshesHypothesisModification();
+
+  MESSAGE("BLSURFPlugin_Hypothesis::AddFacePeriodicity END");
+}
+
+
+//=======================================================================
+//function : AddEdgePeriodicity
+//=======================================================================
+void BLSURFPlugin_Hypothesis::AddEdgePeriodicity(TEntry face1Entry, TEntry edge1Entry, TEntry face2Entry, TEntry edge2Entry, int edge_orientation) {
+
+  MESSAGE("BLSURFPlugin_Hypothesis::AddEdgePeriodicity("<< edge1Entry << ", "
+      << edge2Entry << ")");
+
+  TEdgePeriodicity edgePeriodicity;
+  edgePeriodicity.face1Entry = face1Entry;
+  edgePeriodicity.edge1Entry = edge1Entry;
+  edgePeriodicity.face2Entry = face2Entry;
+  edgePeriodicity.edge2Entry = edge2Entry;
+  edgePeriodicity.edge_orientation = edge_orientation;
+
+  _edgesPeriodicityVector.push_back(edgePeriodicity);
+
+  NotifySubMeshesHypothesisModification();
+
+  MESSAGE("BLSURFPlugin_Hypothesis::AddEdgePeriodicity END");
+}
+
+//=======================================================================
+//function : AddVertexPeriodicity
+//=======================================================================
+void BLSURFPlugin_Hypothesis::AddVertexPeriodicity(TEntry edge1Entry, TEntry vertex1Entry, TEntry edge2Entry, TEntry vertex2Entry) {
+
+  MESSAGE("BLSURFPlugin_Hypothesis::AddVertexPeriodicity("<< vertex1Entry << ", "
+      << vertex2Entry << ")");
+
+  TVertexPeriodicity vertexPeriodicity;
+  vertexPeriodicity.edge1Entry = edge1Entry;
+  vertexPeriodicity.vertex1Entry = vertex1Entry;
+  vertexPeriodicity.edge2Entry = edge2Entry;
+  vertexPeriodicity.vertex2Entry = vertex2Entry;
+
+  _verticesPeriodicityVector.push_back(vertexPeriodicity);
+
+  NotifySubMeshesHypothesisModification();
+
+  MESSAGE("BLSURFPlugin_Hypothesis::AddVertexPeriodicity END");
+}
+
 //=============================================================================
 std::ostream & BLSURFPlugin_Hypothesis::SaveTo(std::ostream & save) {
    // We must keep at least the same number of arguments when increasing the SALOME version
index 885bb90ec2e98266c4411aca5286237fd0deae33..2ad4eafaf30dc8bd5b67ba834f9c9eb71cd4346b 100644 (file)
@@ -216,6 +216,32 @@ public:
     }
   };
 
+  // PreCad Face and Edge periodicity
+  struct TPreCadPeriodicity {
+    TEntry shape1Entry;
+    TEntry shape2Entry;
+    const char* f_funct;
+  };
+
+  // Edge periodicity
+  struct TEdgePeriodicity {
+    TEntry face1Entry;
+    TEntry edge1Entry;
+    TEntry face2Entry;
+    TEntry edge2Entry;
+    int edge_orientation;
+  };
+
+  // Vertex periodicity
+  struct TVertexPeriodicity {
+    TEntry edge1Entry;
+    TEntry vertex1Entry;
+    TEntry edge2Entry;
+    TEntry vertex2Entry;
+  };
+
+  typedef std::pair< TEntry, TEntry > TFacesPeriodicity;
+
   // List of enforced vertices
   typedef std::set< TEnfVertex*, CompareEnfVertices > TEnfVertexList;
 
@@ -243,7 +269,13 @@ public:
   typedef std::map< TEnfGroupName , TEnfVertexList > TGroupNameEnfVertexListMap;
   */
 
+  // Vector of pairs of entries
+  typedef std::vector< TPreCadPeriodicity > TPreCadPeriodicityVector;
+  typedef std::vector< TFacesPeriodicity > TFacesPeriodicityVector;
+  typedef std::vector< TEdgePeriodicity > TEdgesPeriodicityVector;
+  typedef std::vector< TVertexPeriodicity > TVerticesPeriodicityVector;
   
+
   bool                  SetEnforcedVertex(TEntry theFaceEntry, TEnfName theVertexName, TEntry theVertexEntry, TEnfGroupName theGroupName,
                                           double x = 0.0, double y = 0.0, double z = 0.0);
   TEnfVertexList        GetEnfVertexList(const TEntry& theFaceEntry) throw (std::invalid_argument);
@@ -354,6 +386,33 @@ public:
   static TEnfVertexGroupNameMap     GetDefaultEnfVertexGroupNameMap() { return TEnfVertexGroupNameMap(); }
   */
 
+  static TPreCadPeriodicityVector GetDefaultPreCadFacesPeriodicityVector() { return TPreCadPeriodicityVector(); }
+  const TPreCadPeriodicityVector  _GetPreCadFacesPeriodicityVector() const { return _preCadFacesPeriodicityVector; }
+  static TPreCadPeriodicityVector GetPreCadFacesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
+
+  static TPreCadPeriodicityVector GetDefaultPreCadEdgesPeriodicityVector() { return TPreCadPeriodicityVector(); }
+  const TPreCadPeriodicityVector  _GetPreCadEdgesPeriodicityVector() const { return _preCadEdgesPeriodicityVector; }
+  static TPreCadPeriodicityVector GetPreCadEdgesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
+
+  static TFacesPeriodicityVector GetDefaultFacesPeriodicityVector() { return TFacesPeriodicityVector(); }
+  const TFacesPeriodicityVector  _GetFacesPeriodicityVector() const { return _facesPeriodicityVector; }
+  static TFacesPeriodicityVector GetFacesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
+
+  static TEdgesPeriodicityVector GetDefaultEdgesPeriodicityVector() { return TEdgesPeriodicityVector(); }
+  const TEdgesPeriodicityVector  _GetEdgesPeriodicityVector() const { return _edgesPeriodicityVector; }
+  static TEdgesPeriodicityVector GetEdgesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
+
+  static TVerticesPeriodicityVector GetDefaultVerticesPeriodicityVector() { return TVerticesPeriodicityVector(); }
+  const TVerticesPeriodicityVector  _GetVerticesPeriodicityVector() const { return _verticesPeriodicityVector; }
+  static TVerticesPeriodicityVector GetVerticesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
+
+  void AddPreCadFacesPeriodicity(TEntry faces1Entry, TEntry faces2Entry, const char* f_funct);
+  void AddPreCadEdgesPeriodicity(TEntry edges1Entry, TEntry edges2Entry, const char* f_funct);
+
+  void AddFacePeriodicity(TEntry face1Entry, TEntry face2Entry);
+  void AddEdgePeriodicity(TEntry face1Entry, TEntry edge1Entry, TEntry face2Entry, TEntry edge2Entry, int edge_orientation = 0);
+  void AddVertexPeriodicity(TEntry edge1Entry, TEntry vertex1Entry, TEntry edge2Entry, TEntry vertex2Entry);
+
   static double undefinedDouble() { return -1.0; }
 
   typedef std::map< std::string, std::string > TOptionValues;
@@ -451,6 +510,13 @@ private:
   bool            _enforcedInternalVerticesAllFaces;
   TEnfGroupName   _enforcedInternalVerticesAllFacesGroup;
   
+  TPreCadPeriodicityVector _preCadFacesPeriodicityVector;
+  TPreCadPeriodicityVector _preCadEdgesPeriodicityVector;
+
+  TFacesPeriodicityVector _facesPeriodicityVector;
+  TEdgesPeriodicityVector _edgesPeriodicityVector;
+  TVerticesPeriodicityVector _verticesPeriodicityVector;
+
   std::string     _GMFFileName;
 //   bool            _GMFFileMode;
 
index 496cf4043c4ae8cc6db2863a543bc0a46f4deca6..303c360c578ac59ef3a6a2900af31fb602fc01f9 100644 (file)
@@ -2584,6 +2584,328 @@ 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<GEOM::shape_type, std::string> 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<GEOM::shape_type> theShapeTypes)
+{
+  // Check shape types
+  bool ok = false;
+  std::stringstream typesTxt;
+  for (std::size_t i=0; i<theShapeTypes.size(); i++)
+    {
+      GEOM::shape_type theShapeType = theShapeTypes[i];
+      if (shape->GetShapeType() == 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;
+}
+
+void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr faces1, GEOM::GEOM_Object_ptr faces2, const char* f_transf)
+throw (SALOME::SALOME_Exception)
+{
+  ASSERT(myBaseImpl);
+
+  std::vector<GEOM::shape_type> allowedShapeTypes;
+  allowedShapeTypes.push_back(GEOM::FACE);
+  allowedShapeTypes.push_back(GEOM::COMPOUND);
+
+  string prefix1 = "Source_face_";
+  CheckShapeTypes(faces1, allowedShapeTypes);
+  string faces1Entry = PublishIfNeeded(faces1, GEOM::FACE, prefix1);
+  string prefix2 = "Target_face_";
+  CheckShapeTypes(faces2, allowedShapeTypes);
+  string faces2Entry = PublishIfNeeded(faces2, GEOM::FACE, prefix2);
+
+  string faces2Name = faces2->GetName();
+  MESSAGE("IDL : faces1->GetName : " << faces1->GetName());
+  MESSAGE("IDL : faces2->GetName : " << faces2->GetName());
+  MESSAGE("IDL : AddPreCadFacesPeriodicity( "<< faces1Entry << ", " << faces2Entry << ", " << f_transf << ")");
+  try {
+      AddPreCadFacesPeriodicityEntry(faces1Entry.c_str(), faces2Entry.c_str(), f_transf);
+  } catch (SALOME_Exception& ex) {
+    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+  }
+}
+
+void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* faces1Entry, const char* faces2Entry, const char* f_transf)
+    throw (SALOME::SALOME_Exception)
+{
+
+  ASSERT(myBaseImpl);
+
+  MESSAGE("IDL : AddPreCadFacesPeriodicityEntry(" << faces1Entry << ", " << faces2Entry << ", \"" << f_transf << "\")");
+  this->GetImpl()->AddPreCadFacesPeriodicity(faces1Entry, faces2Entry, f_transf);
+  SMESH::TPythonDump pd;
+  pd << _this() << ".AddPreCadFacesPeriodicity(" << faces1Entry << ", " << faces2Entry;
+  if (f_transf != "")
+    pd << ", \"" << f_transf << "\"";
+  pd << ")";
+  MESSAGE("IDL : AddPreCadFacesPeriodicityEntry END");
+}
+
+void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr edges1, GEOM::GEOM_Object_ptr edges2, const char* f_transf)
+      throw (SALOME::SALOME_Exception)
+{
+  ASSERT(myBaseImpl);
+
+  std::vector<GEOM::shape_type> allowedShapeTypes;
+  allowedShapeTypes.push_back(GEOM::EDGE);
+  allowedShapeTypes.push_back(GEOM::COMPOUND);
+
+  string prefix1 = "Source_edge_";
+  CheckShapeTypes(edges1, allowedShapeTypes);
+  string edges1Entry = PublishIfNeeded(edges1, GEOM::EDGE, prefix1);
+  string prefix2 = "Target_edge_";
+  CheckShapeTypes(edges2, allowedShapeTypes);
+  string edges2Entry = PublishIfNeeded(edges2, GEOM::EDGE, prefix2);
+
+  string edges2Name = edges2->GetName();
+  MESSAGE("IDL : edges1->GetName : " << edges1->GetName());
+  MESSAGE("IDL : edges2->GetName : " << edges2->GetName());
+  MESSAGE("IDL : AddPreCadEdgesPeriodicity( "<< edges1Entry << ", " << edges2Entry << ", " << f_transf << ")");
+  try {
+      AddPreCadEdgesPeriodicityEntry(edges1Entry.c_str(), edges2Entry.c_str(), f_transf);
+  } catch (SALOME_Exception& ex) {
+    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+  }
+}
+
+
+void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* edges1Entry, const char* edges2Entry, const char* f_transf)
+    throw (SALOME::SALOME_Exception)
+{
+
+  ASSERT(myBaseImpl);
+
+  MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry(" << edges1Entry << ", " << edges2Entry << ", \"" << f_transf << "\")");
+  this->GetImpl()->AddPreCadEdgesPeriodicity(edges1Entry, edges2Entry, f_transf);
+  SMESH::TPythonDump pd;
+  pd << _this() << ".AddPreCadEdgesPeriodicity(" << edges1Entry << ", " << edges2Entry;
+  if (f_transf != "")
+    pd << ", \"" << f_transf << "\"";
+  pd << ")";
+  MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry END");
+}
+
+void BLSURFPlugin_Hypothesis_i::AddFacePeriodicity(GEOM::GEOM_Object_ptr face1, GEOM::GEOM_Object_ptr face2)
+    throw (SALOME::SALOME_Exception)
+{
+  ASSERT(myBaseImpl);
+
+  string prefix1 = "Source_face_";
+  CheckShapeType(face1, GEOM::FACE);
+  string face1Entry = PublishIfNeeded(face1, GEOM::FACE, prefix1);
+  string prefix2 = "Target_face_";
+  CheckShapeType(face2, GEOM::FACE);
+  string face2Entry = PublishIfNeeded(face2, GEOM::FACE, prefix2);
+
+  MESSAGE("IDL : face1->GetName : " << face1->GetName());
+  MESSAGE("IDL : face2->GetName : " << face2->GetName());
+  MESSAGE("IDL : AddFacePeriodicity( "<< face1Entry << ", " << face2Entry << ")");
+  try {
+      AddFacePeriodicityEntry(face1Entry.c_str(), face2Entry.c_str());
+  } catch (SALOME_Exception& ex) {
+    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+  }
+
+
+}
+
+void BLSURFPlugin_Hypothesis_i::AddFacePeriodicityEntry(const char* face1Entry, const char* face2Entry)
+    throw (SALOME::SALOME_Exception){
+
+  ASSERT(myBaseImpl);
+
+  MESSAGE("IDL : AddFacePeriodicityEntry(" << face1Entry << ", " << face2Entry << ")");
+  this->GetImpl()->AddFacePeriodicity(face1Entry, face2Entry);
+  SMESH::TPythonDump pd;
+  pd << _this() << ".AddFacePeriodicity(" << face1Entry << ", " << face2Entry << ")";
+  MESSAGE("IDL : AddFacePeriodicityEntry END");
+}
+
+
+void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicity(GEOM::GEOM_Object_ptr face1, GEOM::GEOM_Object_ptr edge1,
+    GEOM::GEOM_Object_ptr face2, GEOM::GEOM_Object_ptr edge2, int edge_orientation)
+    throw (SALOME::SALOME_Exception){
+  ASSERT(myBaseImpl);
+
+  string prefix_face1 = "Source_face_";
+  CheckShapeType(face1, GEOM::FACE);
+  string face1Entry = PublishIfNeeded(face1, GEOM::FACE, prefix_face1);
+  string prefix_face2 = "Target_face_";
+  CheckShapeType(face2, GEOM::FACE);
+  string face2Entry = PublishIfNeeded(face2, GEOM::FACE, prefix_face2);
+
+  string prefix_edge1 = "Source_edge_";
+  CheckShapeType(edge1, GEOM::EDGE);
+  string edge1Entry = PublishIfNeeded(edge1, GEOM::EDGE, prefix_edge1);
+  string prefix_edge2 = "Target_edge_";
+  CheckShapeType(edge2, GEOM::EDGE);
+  string edge2Entry = PublishIfNeeded(edge2, GEOM::EDGE, prefix_edge2);
+
+  MESSAGE("IDL : face1->GetName : " << face1->GetName());
+  MESSAGE("IDL : edge1->GetName : " << edge1->GetName());
+  MESSAGE("IDL : face2->GetName : " << face2->GetName());
+  MESSAGE("IDL : edge2->GetName : " << edge2->GetName());
+  MESSAGE("IDL : AddEdgePeriodicity( "<< face1Entry << ", " << edge1Entry << ", " << face2Entry << ", "  << edge2Entry << ", " << edge_orientation << ")");
+  try {
+      AddEdgePeriodicityEntry(face1Entry.c_str(), edge1Entry.c_str(), face2Entry.c_str(), edge2Entry.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 edge1,
+    GEOM::GEOM_Object_ptr edge2, int edge_orientation)
+    throw (SALOME::SALOME_Exception){
+  ASSERT(myBaseImpl);
+
+  string face1Entry = "";
+  string face2Entry = "";
+
+  string prefix_edge1 = "Source_edge_";
+  CheckShapeType(edge1, GEOM::EDGE);
+  string edge1Entry = PublishIfNeeded(edge1, GEOM::EDGE, prefix_edge1);
+  string prefix_edge2 = "Target_edge_";
+  CheckShapeType(edge2, GEOM::EDGE);
+  string edge2Entry = PublishIfNeeded(edge2, GEOM::EDGE, prefix_edge2);
+
+  MESSAGE("IDL : edge1->GetName : " << edge1->GetName());
+  MESSAGE("IDL : edge2->GetName : " << edge2->GetName());
+  MESSAGE("IDL : AddEdgePeriodicity( "<< face1Entry << ", " << edge1Entry << ", " << face2Entry << ", "  << edge2Entry << ", " << edge_orientation << ")");
+  try {
+      AddEdgePeriodicityEntry(face1Entry.c_str(), edge1Entry.c_str(), face2Entry.c_str(), edge2Entry.c_str(), edge_orientation);
+  } catch (SALOME_Exception& ex) {
+    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+  }
+
+
+}
+
+void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicityEntry(const char* face1Entry, const char* edge1Entry, const char* face2Entry, const char* edge2Entry, const int edge_orientation)
+    throw (SALOME::SALOME_Exception){
+
+  ASSERT(myBaseImpl);
+
+  MESSAGE("IDL : AddEdgePeriodicityEntry(" << face1Entry << ", " << edge1Entry << ", " << face2Entry << ", "  << edge2Entry << ", " << edge_orientation << ")");
+  this->GetImpl()->AddEdgePeriodicity(face1Entry, edge1Entry, face2Entry, edge2Entry, edge_orientation);
+  SMESH::TPythonDump pd;
+  if (face1Entry)
+    pd << _this() << ".AddEdgePeriodicity(" << face1Entry << ", " << edge1Entry << ", " << face2Entry << ", "  << edge2Entry << ", " << edge_orientation <<")";
+  else
+    pd << _this() << ".AddEdgePeriodicityWithoutFaces(" << edge1Entry << ", " << edge2Entry << ", " << edge_orientation <<")";
+  MESSAGE("IDL : AddEdgePeriodicityEntry END");
+}
+
+void BLSURFPlugin_Hypothesis_i::AddVertexPeriodicity(GEOM::GEOM_Object_ptr edge1, GEOM::GEOM_Object_ptr vertex1,
+    GEOM::GEOM_Object_ptr edge2, GEOM::GEOM_Object_ptr vertex2)
+    throw (SALOME::SALOME_Exception){
+  ASSERT(myBaseImpl);
+
+  string prefix_edge1 = "Source_edge_";
+  CheckShapeType(edge1, GEOM::EDGE);
+  string edge1Entry = PublishIfNeeded(edge1, GEOM::EDGE, prefix_edge1);
+  string prefix_edge2 = "Target_edge_";
+  CheckShapeType(edge2, GEOM::EDGE);
+  string edge2Entry = PublishIfNeeded(edge2, GEOM::EDGE, prefix_edge2);
+
+  string prefix_vertex1 = "Source_vertex_";
+  CheckShapeType(vertex1, GEOM::VERTEX);
+  string vertex1Entry = PublishIfNeeded(vertex1, GEOM::VERTEX, prefix_vertex1);
+  string prefix_vertex2 = "Target_vertex_";
+  CheckShapeType(vertex2, GEOM::VERTEX);
+  string vertex2Entry = PublishIfNeeded(vertex2, GEOM::VERTEX, prefix_vertex2);
+
+  MESSAGE("IDL : edge1->GetName : " << edge1->GetName());
+  MESSAGE("IDL : vertex1->GetName : " << vertex1->GetName());
+  MESSAGE("IDL : edge2->GetName : " << edge2->GetName());
+  MESSAGE("IDL : vertex2->GetName : " << vertex2->GetName());
+  MESSAGE("IDL : AddVertexPeriodicity( "<< edge1Entry << ", " << vertex1Entry << ", " << edge2Entry << ", "  << vertex2Entry << ")");
+  try {
+      AddVertexPeriodicityEntry(edge1Entry.c_str(), vertex1Entry.c_str(), edge2Entry.c_str(), vertex2Entry.c_str());
+  } catch (SALOME_Exception& ex) {
+    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+  }
+
+
+}
+
+void BLSURFPlugin_Hypothesis_i::AddVertexPeriodicityEntry(const char* edge1Entry, const char* vertex1Entry, const char* edge2Entry, const char* vertex2Entry)
+    throw (SALOME::SALOME_Exception){
+
+  ASSERT(myBaseImpl);
+
+  MESSAGE("IDL : AddVertexPeriodicityEntry(" << edge1Entry << ", " << vertex1Entry << ", " << edge2Entry << ", "  << vertex2Entry << ")");
+  this->GetImpl()->AddVertexPeriodicity(edge1Entry, vertex1Entry, edge2Entry, vertex2Entry);
+  SMESH::TPythonDump pd;
+  pd << _this() << ".AddVertexPeriodicity(" << edge1Entry << ", " << vertex1Entry << ", " << edge2Entry << ", "  << vertex2Entry << ")";
+  MESSAGE("IDL : AddVertexPeriodicityEntry END");
+}
+
 
 //================================================================================
 /*!
index 62cb6570edf6779f6b89b5ac3480f164f0427cb9..fe46de21068e63360875c5ec7cc8165f57f9ed72 100644 (file)
@@ -254,6 +254,50 @@ public:
 //  CORBA::Boolean GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception);
 //  CORBA::Boolean GetInternalEnforcedVertexEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception);
   
+  ///////////////////////
+  // PERIODICITY       //
+  ///////////////////////
+
+  std::string ShapeTypeToString(GEOM::shape_type theShapeType);
+  void CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType);
+  void CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes);
+  std::string PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix);
+
+  void AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr faces1, GEOM::GEOM_Object_ptr faces2, const char* f_transf = "")
+      throw (SALOME::SALOME_Exception);
+
+  void AddPreCadFacesPeriodicityEntry(const char* faces1Entry, const char* faces2Entry, const char* f_transf = "")
+      throw (SALOME::SALOME_Exception);
+
+  void AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr edges1, GEOM::GEOM_Object_ptr edges2, const char* f_transf = "")
+      throw (SALOME::SALOME_Exception);
+
+  void AddPreCadEdgesPeriodicityEntry(const char* edges1Entry, const char* edges2Entry, const char* f_transf = "")
+      throw (SALOME::SALOME_Exception);
+
+  void AddFacePeriodicity(GEOM::GEOM_Object_ptr face1, GEOM::GEOM_Object_ptr face2)
+      throw (SALOME::SALOME_Exception);
+
+  void AddFacePeriodicityEntry(const char* face1Entry, const char* face2Entry)
+    throw (SALOME::SALOME_Exception);
+
+  void AddEdgePeriodicity(GEOM::GEOM_Object_ptr face1, GEOM::GEOM_Object_ptr edge1,
+      GEOM::GEOM_Object_ptr face2, GEOM::GEOM_Object_ptr edge2, int edge_orientation = 0)
+      throw (SALOME::SALOME_Exception);
+
+  void AddEdgePeriodicityWithoutFaces(GEOM::GEOM_Object_ptr edge1, GEOM::GEOM_Object_ptr edge2, int edge_orientation = 0)
+      throw (SALOME::SALOME_Exception);
+
+  void AddEdgePeriodicityEntry(const char* face1Entry, const char* edge1Entry, const char* face2Entry, const char* edge2Entry, int edge_orientation = 0)
+    throw (SALOME::SALOME_Exception);
+
+  void AddVertexPeriodicity(GEOM::GEOM_Object_ptr edge1, GEOM::GEOM_Object_ptr vertex1,
+      GEOM::GEOM_Object_ptr edge2, GEOM::GEOM_Object_ptr vertex2)
+      throw (SALOME::SALOME_Exception);
+
+  void AddVertexPeriodicityEntry(const char* edge1Entry, const char* vertex1Entry, const char* edge2Entry, const char* vertex2Entry)
+    throw (SALOME::SALOME_Exception);
+
   ///////////////////////
   
   /*!