Salome HOME
CEA_1537: remove deprecated precad to be able to use MeshGems 2.3
authorChristophe Bourcier <christophe.bourcier@cea.fr>
Wed, 6 Jul 2016 09:45:02 +0000 (11:45 +0200)
committerChristophe Bourcier <christophe.bourcier@cea.fr>
Wed, 6 Jul 2016 09:45:02 +0000 (11:45 +0200)
- removing calls to PreCAD process
- PreCAD options are called as CADSurf Options
- adding remove_duplicate_cad_faces option as standard option to disable it by default since we can't deactivate all preprocessing tasks as before
- removing deprecated basic periodicity

25 files changed:
adm_local/cmake_files/FindMESHGEMS.cmake
adm_local/unix/config_files/check_MESHGEMS_CADSURF.m4
doc/salome/gui/BLSURFPLUGIN/input/blsurf_hypo.doc
doc/salome/gui/BLSURFPLUGIN/input/blsurfplugin_python_interface.doc
idl/BLSURFPlugin_Algorithm.idl
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
src/GUI/BLSURFPluginGUI_AdvWidget_QTD.ui
src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx
src/GUI/BLSURFPluginGUI_HypothesisCreator.h
src/GUI/BLSURFPlugin_msg_en.ts
src/GUI/BLSURFPlugin_msg_fr.ts
tests/test_periodicity.py [deleted file]
tests/test_periodicity_2D.py [deleted file]
tests/test_periodicity_reflexion.py [deleted file]
tests/test_periodicity_reflexion_2D.py [deleted file]
tests/test_precad_intersections.py
tests/test_precad_keep_gaps.py
tests/test_proximity.py
tests/test_quadrangles_gradation.py

index 079f0c3b49a80595ef035f75386229b9e4a24caf..2e62b45608d29a718de79a7941866292db477550 100644 (file)
@@ -48,13 +48,11 @@ ELSE()
 ENDIF(WIN32)
 
 FIND_LIBRARY(MESHGEMS_LIBRARY_mg-cadsurf NAMES mg-cadsurf PATH_SUFFIXES ${_plt})
-FIND_LIBRARY(MESHGEMS_LIBRARY_mg-precad NAMES mg-precad PATH_SUFFIXES ${_plt})
 FIND_LIBRARY(MESHGEMS_LIBRARY_meshgems NAMES meshgems PATH_SUFFIXES ${_plt})
 
 # TODO: search all components
 SET(MESHGEMS_LIBRARIES)
 SET(MESHGEMS_LIBRARIES ${MESHGEMS_LIBRARIES} ${MESHGEMS_LIBRARY_mg-cadsurf})
-SET(MESHGEMS_LIBRARIES ${MESHGEMS_LIBRARIES} ${MESHGEMS_LIBRARY_mg-precad})
 IF(MESHGEMS_LIBRARY_meshgems)
   SET(MESHGEMS_LIBRARIES ${MESHGEMS_LIBRARIES} ${MESHGEMS_LIBRARY_meshgems})
 ENDIF(MESHGEMS_LIBRARY_meshgems)
index 6baabd3466c30040f74a737ed6000ba5cf1fcdf8..2a555a084054ef053761a421c0ecb3e7f04fe412 100644 (file)
@@ -74,7 +74,7 @@ if test "$with-meshgems" != "no" ; then
     if test $archtest = "x86_64" ; then
         LOCAL_LIBS="-L$MESHGEMS_CADSURF_HOME/lib/Linux_64"
     fi
-    LOCAL_LIBS="${LOCAL_LIBS} -lmeshgems -lmg-cadsurf -lmg-precad"
+    LOCAL_LIBS="${LOCAL_LIBS} -lmeshgems -lmg-cadsurf"
 
     CPPFLAGS_old="$CPPFLAGS"
     CXXFLAGS_old="$CXXFLAGS"
index 81f4075a48bb059715c7b67c4539ebcdca6c8d58..07ebef7ffe73d579bc752a7a2c568fd28bf82686 100644 (file)
@@ -444,9 +444,7 @@ A group can optionnaly be defined on those enforced vertices.
 Periodicity is used to have the same discretization on two faces (in 3D) or two edges (in 2D).
 This is useful for instance for a Representative Volume Element so that the translated meshes share the same nodes on the common faces.
 
-In GUI, periodicity association uses PreCAD (optional MG-CADSurf add-on). You must have a PreCAD license to be able to use it.
-
-In TUI, advanced users can use CADSurf periodicity via \ref periodicity_tui_basic_api_usage "the basic API" or \ref periodicity_tui_advanced_api_usage "the advanced API". It requires to disable PreCAD. We strongly advise to use PreCAD periodicity instead.
+Periodicity association uses PreCAD (MG-CADSurf preprocessor). You don't need an extra PreCAD license. It is included in MG-CADSurf since MeshGems V2.2.
 
 \image html blsurf_periodicity_translation.png "Two periodic faces (translation)"
 
@@ -472,36 +470,13 @@ Otherwise, for instance a rotation, the user has to define 3 non-colinear vertic
 The two methods to define periodicity with PreCAD are
 (the former name of <em>MG-CADSurf</em> is \a BLSURF and names
 of the corresponding classes and modules still include \a "BLSURF"):
-- BLSURFPluginBuilder.BLSURF_Algorithm.AddPreCadFacesPeriodicity 
+- BLSURFPluginBuilder.BLSURF_Algorithm.AddPreCadFacesPeriodicity
 - BLSURFPluginBuilder.BLSURF_Algorithm.AddPreCadEdgesPeriodicity
 
 List of source and target vertices to define a transformation are optional.
 
 \sa Sample TUI Script of the definition of MG-CADSurf periodicity \ref tui_blsurf_periodicity_preCAD "using preCAD".
 
-\subsection periodicity_tui_basic_api_usage TUI Basic API usage
-
-In the CADSurf basic API, only available in TUI, the periodicity must be defined face by face, edge by edge and vertex by vertex.
-
-You must disable PreCAD to use it. Hence, shapes with seam edges will not be meshed correctly.
-
-The methods are:
-- BLSURFPluginBuilder.BLSURF_Algorithm.AddFacePeriodicity
-- BLSURFPluginBuilder.BLSURF_Algorithm.AddEdgePeriodicity
-- BLSURFPluginBuilder.BLSURF_Algorithm.AddEdgePeriodicityWithoutFaces
-- BLSURFPluginBuilder.BLSURF_Algorithm.AddVertexPeriodicity
-
-Sample TUI Script of the definition of MG-CADSurf periodicity \ref tui_blsurf_periodicity_basic "using basic API (without preCAD)".
-
-\subsection periodicity_tui_advanced_api_usage TUI Advanced API usage
-
-To ease the periodicity description, the basic API methods can be called through two advanced methods, given two geom groups and a python geom transformation:
-
-- BLSURFPluginBuilder.BLSURF_Algorithm.AddAdvancedFacesPeriodicity (in 3D)
-- BLSURFPluginBuilder.BLSURF_Algorithm.AddAdvancedEdgesPeriodicity (in 2D)
-
-Sample TUI Script of the definition of MG-CADSurf periodicity \ref tui_blsurf_periodicity_advanced "using advanced API (without preCAD)".
-
 \ref blsurf_top "Back to top"
 
 For more information on MeshGems-CADSurf, you can read its documentation at $MESHGEMS_ROOT_DIR/Docs/mg-cadsurf_user_manual.pdf
index 5a4471aef7a62964dd053a0fb9a8c251983c4abe..710043e0164d6d4515f39f5322c9eeb273594a09 100644 (file)
@@ -22,19 +22,11 @@ Below you can see examples of usage of this class for 2D mesh generation.
 \anchor tui_blsurf
 
 \anchor example_BLSURFPlugin
-<h2>Example of mesh generation with MG-CADSurf algorithm:</h2>
+<h2>Example of mesh generation with MG-CADSurf algorithm</h2>
 \tui_script{blsurfdemo.py}
 
 \anchor tui_blsurf_periodicity_preCAD
 <h2>Example of periodicity definition with preCAD</h2>
 \tui_script{test_periodicity_precad.py}
 
-\anchor tui_blsurf_periodicity_basic
-<h2>Example of basic periodicity definition (without preCAD)</h2>
-\tui_script{test_periodicity.py}
-
-\anchor tui_blsurf_periodicity_advanced
-<h2>Example of advanced periodicity definition (without preCAD)</h2>
-\tui_script{test_periodicity_reflexion_advanced.py}
-
 */
index 5310803ac50b59310f75113a982747db35bcfde3..aaeb540e50f7d173e50e793114d508fa9f525f06 100644 (file)
@@ -277,6 +277,12 @@ module BLSURFPlugin
     void SetPreCADMergeEdges(in boolean toMergeEdges);
     boolean GetPreCADMergeEdges();
 
+    /*!
+     * To remove duplicate CAD faces.
+     */
+    void SetPreCADRemoveDuplicateCADFaces(in boolean toRemoveDuplicateCADFaces);
+    boolean GetPreCADRemoveDuplicateCADFaces();
+
     /*!
      * To process 3D topology.
      */
@@ -457,10 +463,6 @@ module BLSURFPlugin
     void AddPreCadEdgesPeriodicity(in GEOM::GEOM_Object theEdge1, in GEOM::GEOM_Object theEdge2) raises (SALOME::SALOME_Exception);
     void AddPreCadEdgesPeriodicityWithVertices(in GEOM::GEOM_Object theEdge1, in GEOM::GEOM_Object theEdge2, in GEOM::ListOfGO theSourceVertices, in GEOM::ListOfGO theTargetVertices) raises (SALOME::SALOME_Exception);
     void AddPreCadEdgesPeriodicityEntry(in TEntry theEdge1, in TEntry theEdge2, in TEntryList theSourceVertices, in TEntryList theTargetVertices)  raises (SALOME::SALOME_Exception);
-    void AddFacePeriodicity(in GEOM::GEOM_Object theFace1, in GEOM::GEOM_Object theFace2) raises (SALOME::SALOME_Exception);
-    void AddEdgePeriodicity(in GEOM::GEOM_Object theFace1, in GEOM::GEOM_Object theEdge1, in GEOM::GEOM_Object theFace2, in GEOM::GEOM_Object theEdge2, in long edge_orientation) raises (SALOME::SALOME_Exception);
-    void AddEdgePeriodicityWithoutFaces(in GEOM::GEOM_Object theEdge1, in GEOM::GEOM_Object theEdge2, in long edge_orientation) raises (SALOME::SALOME_Exception);
-    void AddVertexPeriodicity(in GEOM::GEOM_Object theEdge1, in GEOM::GEOM_Object theVertex1, in GEOM::GEOM_Object theEdge2, in GEOM::GEOM_Object theVertex2) raises (SALOME::SALOME_Exception);
     TPeriodicityList GetPreCadFacesPeriodicityVector();
     TPeriodicityList GetPreCadEdgesPeriodicityVector();
     ///////////////////////
index 36e522ef91f7a3d68711e017b3074d32315a9eba..44a8a242918a6a6f56eef41e0702030934150e5d 100644 (file)
@@ -199,6 +199,14 @@ class BLSURF_Algorithm(Mesh_Algorithm):
     self.Parameters().SetPreCADMergeEdges(toMergeEdges)
     pass
 
+  ## To remove duplicate CAD Faces
+  #  @param toRemoveDuplicateCADFaces "merge edges" flag value
+  def SetPreCADRemoveDuplicateCADFaces(self, toRemoveDuplicateCADFaces=False):
+    if self.Parameters().GetTopology() != PreCAD:
+      self.SetTopology(PreCAD)
+    self.Parameters().SetPreCADRemoveDuplicateCADFaces(toRemoveDuplicateCADFaces)
+    pass
+
   ## To process 3D topology.
   #  @param toProcess "PreCAD process 3D" flag value
   def SetPreCADProcess3DTopology(self, toProcess=False):
@@ -502,123 +510,6 @@ class BLSURF_Algorithm(Mesh_Algorithm):
         self.Parameters().AddPreCadEdgesPeriodicity(theEdge1, theEdge2)
     pass
 
-
-  #-----------------------------------------
-  # Periodicity (BLSURF without PreCAD)
-  #-----------------------------------------
-
-
-  ## Defines periodicity between two faces, without using PreCAD.
-  #  User has to call AddEdgePeriodicity with the edges of the face,
-  #  and AddVertexPeriodicity with the vertices of each edge.
-  #  @param theFace1 : GEOM face to associate with theFace2
-  #  @param theFace2 : GEOM face associated with theFace1
-  def AddFacePeriodicity(self, theFace1, theFace2):
-    self.Parameters().AddFacePeriodicity(theFace1, theFace2)
-    pass
-      
-  ## Defines periodicity between two edges belonging to two periodic faces, without using PreCAD.
-  #  To be used with AddFacePeriodicity.
-  #  User has to call AddVertexPeriodicity with the vertices of each edge
-  #  @param theFace1 : GEOM face to associate with theFace2
-  #  @param theEdge1 : GEOM edge to associate with theEdge2
-  #  @param theFace2 : GEOM face associated with theFace1
-  #  @param theEdge2 : GEOM edge associated with theEdge1
-  #  @param theEdgeOrientation : -1 (reversed), 0 (unknown) or 1 (forward)
-  def AddEdgePeriodicity(self, theFace1, theEdge1, theFace2, theEdge2, theEdgeOrientation=0):
-    self.Parameters().AddEdgePeriodicity(theFace1, theEdge1, theFace2, theEdge2, theEdgeOrientation)
-    pass
-
-  ## Defines periodicity between two edges without face periodicity, without using PreCAD.
-  #  User has to call AddVertexPeriodicity with the vertices of each edge.
-  #  @param theEdge1 : GEOM edge to associate with theEdge2
-  #  @param theEdge2 : GEOM edge associated with theEdge1
-  #  @param theEdgeOrientation : -1 (reversed), 0 (unknown) or 1 (forward)
-  def AddEdgePeriodicityWithoutFaces(self, theEdge1, theEdge2, theEdgeOrientation=0):
-    self.Parameters().AddEdgePeriodicityWithoutFaces(theEdge1, theEdge2, theEdgeOrientation)
-    pass
-      
-  ## Defines periodicity between two vertices.
-  #  To be used with AddFacePeriodicity and AddEdgePeriodicity.
-  #  @param theEdge1 : GEOM edge to associate with theEdge2
-  #  @param theVertex1 : GEOM face to associate with theVertex2
-  #  @param theEdge2 : GEOM edge associated with theEdge1
-  #  @param theVertex2 : GEOM face associated with theVertex1
-  def AddVertexPeriodicity(self, theEdge1, theVertex1, theEdge2, theVertex2):
-    self.Parameters().AddVertexPeriodicity(theEdge1, theVertex1, theEdge2, theVertex2)
-    pass
-
-  ## Define periodicity between two groups of faces, given a transformation function.
-  #  This uses the basic BLSURF API for each face, each edge, and each vertex.
-  #  @param theFace1 : GEOM face (or group, compound) to associate with theFace2
-  #  @param theFace2 : GEOM face (or group, compound) associated with theFace1
-  #  @param f_transf : python function defining the transformation between an object of theFace1
-  # into an object of theFace2
-  def AddAdvancedFacesPeriodicity(self, theFace1, theFace2, f_transf):
-    source_faces = self.geompyD.SubShapeAll(theFace1, self.geompyD.ShapeType["FACE"])
-    i = 0
-    j = 0
-    k = 0
-    for source_face in source_faces:
-      self.geompyD.addToStudyInFather(theFace1, source_face, "source_face_%i"%i)
-      p_source = self.geompyD.MakeVertexInsideFace(source_face)
-      p_target = f_transf(p_source)
-      target_face = self.geompyD.GetFaceNearPoint(theFace2, p_target)
-      self.geompyD.addToStudyInFather(theFace2, target_face, "target_face_%i"%i)
-      self.AddFacePeriodicity(source_face, target_face)
-      i += 1
-      
-      source_edges = self.geompyD.SubShapeAll(source_face, self.geompyD.ShapeType["EDGE"])
-      for source_edge in source_edges:
-        self.geompyD.addToStudyInFather(theFace1, source_edge, "source_edge_%i"%(j))
-        p_source = self.geompyD.MakeVertexOnCurve(source_edge, 0.5)
-        p_target = f_transf(p_source)
-        target_edge = self.geompyD.GetEdgeNearPoint(theFace2, p_target)
-        self.geompyD.addToStudyInFather(theFace2, target_edge, "target_edge_%i"%(j))
-        self.AddEdgePeriodicity(source_face, source_edge, target_face, target_edge, 1)
-        j += 1
-        
-        source_vertices = self.geompyD.SubShapeAll(source_edge, self.geompyD.ShapeType["VERTEX"])
-        for source_vertex in source_vertices:
-          self.geompyD.addToStudyInFather(theFace1, source_vertex, "source_vertex_%i"%(k))
-          target_vertex_tmp = f_transf(source_vertex)
-          target_vertex = self.geompyD.GetSame(theFace2, target_vertex_tmp)
-          self.geompyD.addToStudyInFather(theFace2, target_vertex, "target_vertex_%i"%(k))
-          self.AddVertexPeriodicity(source_edge, source_vertex, target_edge, target_vertex)
-          k += 1
-      pass
-
-  ## Define periodicity between two groups of edges, without faces, given a transformation function.
-  #  This uses the basic BLSURF API for each edge and each vertex.
-  #  @param theEdge1 : GEOM edge (or group, compound) to associate with theEdge2
-  #  @param theEdge2 : GEOM edge (or group, compound) associated with theEdge1
-  #  @param f_transf : python function defining the transformation between an object of theEdge1
-  # into an object of theFace2
-  def AddAdvancedEdgesPeriodicity(self, theEdge1, theEdge2, f_transf):
-    source_edges = self.geompyD.SubShapeAll(theEdge1, self.geompyD.ShapeType["EDGE"])
-    j = 0
-    k = 0
-    for source_edge in source_edges:
-      self.geompyD.addToStudyInFather(theEdge1, source_edge, "source_edge_%i"%j)
-      p_source = self.geompyD.MakeVertexOnCurve(source_edge, 0.5)
-      p_target = f_transf(p_source)
-      target_edge = self.geompyD.GetEdgeNearPoint(theEdge2, p_target)
-      self.geompyD.addToStudyInFather(theEdge2, target_edge, "target_edge_%i"%j)
-      self.AddEdgePeriodicityWithoutFaces(source_edge, target_edge)
-      
-      j += 1
-      
-      source_vertices = self.geompyD.SubShapeAll(source_edge, self.geompyD.ShapeType["VERTEX"])
-      for source_vertex in source_vertices:
-        self.geompyD.addToStudyInFather(theEdge1, source_vertex, "source_vertex_%i"%k)
-        target_vertex_tmp = f_transf(source_vertex)
-        target_vertex = self.geompyD.GetSame(theEdge2, target_vertex_tmp)
-        self.geompyD.addToStudyInFather(theEdge2, target_vertex, "target_vertex_%i"%k)
-        self.AddVertexPeriodicity(source_edge, source_vertex, target_edge, target_vertex)
-        
-        k += 1
-    pass
-
   #=====================
   # Obsolete methods
   #=====================
index 2af416456290e3282b25b40c3ebc10551c8a3b5d..521f1278a4d699b53d0f0cbfd066e8b0650bb659 100644 (file)
@@ -31,7 +31,6 @@
 extern "C"{
 #include <meshgems/meshgems.h>
 #include <meshgems/cadsurf.h>
-#include <meshgems/precad.h>
 }
 
 #include <structmember.h>
@@ -768,7 +767,7 @@ void BLSURFPlugin_BLSURF::addCoordsFromVertex(BLSURFPlugin_Hypothesis::TEntry th
 /////////////////////////////////////////////////////////
 void BLSURFPlugin_BLSURF::createPreCadFacesPeriodicity(TopoDS_Shape theGeomShape, const BLSURFPlugin_Hypothesis::TPreCadPeriodicity &preCadPeriodicity)
 {
-  MESSAGE("BLSURFPlugin_BLSURF::createFacesPeriodicity");
+  MESSAGE("BLSURFPlugin_BLSURF::createPreCadFacesPeriodicity");
 
   TopoDS_Shape geomShape1 = entryToShape(preCadPeriodicity.shape1Entry);
   TopoDS_Shape geomShape2 = entryToShape(preCadPeriodicity.shape2Entry);
@@ -791,14 +790,14 @@ void BLSURFPlugin_BLSURF::createPreCadFacesPeriodicity(TopoDS_Shape theGeomShape
 
   _preCadFacesIDsPeriodicityVector.push_back(preCadFacesPeriodicityIDs);
   MESSAGE("_preCadFacesIDsPeriodicityVector.size() = " << _preCadFacesIDsPeriodicityVector.size());
-  MESSAGE("BLSURFPlugin_BLSURF::createFacesPeriodicity END");
+  MESSAGE("BLSURFPlugin_BLSURF::createPreCadFacesPeriodicity END");
 
 }
 
 /////////////////////////////////////////////////////////
 void BLSURFPlugin_BLSURF::createPreCadEdgesPeriodicity(TopoDS_Shape theGeomShape, const BLSURFPlugin_Hypothesis::TPreCadPeriodicity &preCadPeriodicity)
 {
-  MESSAGE("BLSURFPlugin_BLSURF::createEdgesPeriodicity");
+  MESSAGE("BLSURFPlugin_BLSURF::createPreCadEdgesPeriodicity");
 
   TopoDS_Shape geomShape1 = entryToShape(preCadPeriodicity.shape1Entry);
   TopoDS_Shape geomShape2 = entryToShape(preCadPeriodicity.shape2Entry);
@@ -815,125 +814,16 @@ void BLSURFPlugin_BLSURF::createPreCadEdgesPeriodicity(TopoDS_Shape theGeomShape
 
   _preCadEdgesIDsPeriodicityVector.push_back(preCadEdgesPeriodicityIDs);
   MESSAGE("_preCadEdgesIDsPeriodicityVector.size() = " << _preCadEdgesIDsPeriodicityVector.size());
-  MESSAGE("BLSURFPlugin_BLSURF::createEdgesPeriodicity END");
-
-}
-
-/////////////////////////////////////////////////////////
-void BLSURFPlugin_BLSURF::createFacesPeriodicity(TopoDS_Shape theGeomShape, BLSURFPlugin_Hypothesis::TEntry theFace1,  BLSURFPlugin_Hypothesis::TEntry theFace2)
-{
-  MESSAGE("BLSURFPlugin_BLSURF::createFacesPeriodicity");
-
-  TopoDS_Shape GeomShape1 = entryToShape(theFace1);
-  TopoDS_Shape GeomShape2 = entryToShape(theFace2);
-
-  TListOfIDs theFace1_ids = _getSubShapeIDsInMainShape(theGeomShape, GeomShape1, TopAbs_FACE);
-  TListOfIDs theFace2_ids = _getSubShapeIDsInMainShape(theGeomShape, GeomShape2, TopAbs_FACE);
-
-  // Only one face id, since only a face can be selected
-  int theFace1_id = theFace1_ids[0];
-  int theFace2_id = theFace2_ids[0];
-
-  std::pair<int, int> pairOfFacesID = std::make_pair(theFace1_id, theFace2_id);
-
-  _facesIDsPeriodicityVector.push_back(pairOfFacesID);
-  MESSAGE("_facesIDsPeriodicityVector.size() = " << _facesIDsPeriodicityVector.size());
-  MESSAGE("BLSURFPlugin_BLSURF::createFacesPeriodicity END");
+  MESSAGE("BLSURFPlugin_BLSURF::createPreCadEdgesPeriodicity END");
 
 }
 
 
-/////////////////////////////////////////////////////////
-void BLSURFPlugin_BLSURF::createEdgesPeriodicity(TopoDS_Shape theGeomShape, BLSURFPlugin_Hypothesis::TEntry theFace1, BLSURFPlugin_Hypothesis::TEntry theEdge1,
-    BLSURFPlugin_Hypothesis::TEntry theFace2, BLSURFPlugin_Hypothesis::TEntry theEdge2, int edge_orientation)
-{
-  MESSAGE("BLSURFPlugin_BLSURF::createEdgesPeriodicity");
-
-  TEdgePeriodicityIDs edgePeriodicityIDs;
-
-  if (theFace1 != "")
-    {
-      TopoDS_Shape GeomFace1 = entryToShape(theFace1);
-      TListOfIDs theFace1_ids = _getSubShapeIDsInMainShape(theGeomShape, GeomFace1, TopAbs_FACE);
-      // Only one face id, since only a face can be selected
-      edgePeriodicityIDs.theFace1ID = theFace1_ids[0];
-    }
-  else
-    edgePeriodicityIDs.theFace1ID = 0;
-  if (theFace2 != "")
-    {
-      TopoDS_Shape GeomFace2 = entryToShape(theFace2);
-      TListOfIDs theFace2_ids = _getSubShapeIDsInMainShape(theGeomShape, GeomFace2, TopAbs_FACE);
-      edgePeriodicityIDs.theFace2ID = theFace2_ids[0];
-    }
-  else
-    edgePeriodicityIDs.theFace2ID = 0;
-
-  TopoDS_Shape GeomEdge1 = entryToShape(theEdge1);
-  TopoDS_Shape GeomEdge2 = entryToShape(theEdge2);
-
-  TListOfIDs theEdge1_ids = _getSubShapeIDsInMainShape(theGeomShape, GeomEdge1, TopAbs_EDGE);
-  TListOfIDs theEdge2_ids = _getSubShapeIDsInMainShape(theGeomShape, GeomEdge2, TopAbs_EDGE);
-
-  if (edge_orientation == 0 && 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.theEdge1ID = theEdge1_ids[0];
-  edgePeriodicityIDs.theEdge2ID = theEdge2_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 theEdge1, BLSURFPlugin_Hypothesis::TEntry theVertex1,
-                                                    BLSURFPlugin_Hypothesis::TEntry theEdge2, BLSURFPlugin_Hypothesis::TEntry theVertex2)
-{
-  MESSAGE("BLSURFPlugin_BLSURF::createVerticesPeriodicity");
-
-  TopoDS_Shape GeomEdge1 = entryToShape(theEdge1);
-  TopoDS_Shape GeomVertex1 = entryToShape(theVertex1);
-  TopoDS_Shape GeomEdge2 = entryToShape(theEdge2);
-  TopoDS_Shape GeomVertex2 = entryToShape(theVertex2);
-
-  TListOfIDs theEdge1_ids = _getSubShapeIDsInMainShape(theGeomShape, GeomEdge1, TopAbs_EDGE);
-  TListOfIDs vertices1_ids = _getSubShapeIDsInMainShape(theGeomShape, GeomVertex1, TopAbs_VERTEX);
-  TListOfIDs theEdge2_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.theEdge1ID = theEdge1_ids[0];
-  vertexPeriodicityIDs.theVertex1ID = vertices1_ids[0];
-  vertexPeriodicityIDs.theEdge2ID = theEdge2_ids[0];
-  vertexPeriodicityIDs.theVertex2ID = vertices2_ids[0];
-
-  _verticesIDsPeriodicityVector.push_back(vertexPeriodicityIDs);
-  MESSAGE("_verticesIDsPeriodicityVector.size() = " << _verticesIDsPeriodicityVector.size());
-  MESSAGE("BLSURFPlugin_BLSURF::createVerticesPeriodicity END");
-
-}
-
 /////////////////////////////////////////////////////////
 
 void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp,
                                         cadsurf_session_t *            css,
-                                        precad_session_t *             pcs,
-                                        const TopoDS_Shape&            theGeomShape,
-                                        bool *                         use_precad
+                                        const TopoDS_Shape&            theGeomShape
                                         )
 {
   // rnc : Bug 1457
@@ -967,6 +857,7 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp,
 
   // PreCAD
   int _precadMergeEdges         = BLSURFPlugin_Hypothesis::GetDefaultPreCADMergeEdges();
+  int _precadRemoveDuplicateCADFaces = BLSURFPlugin_Hypothesis::GetDefaultPreCADRemoveDuplicateCADFaces();
   int _precadProcess3DTopology  = BLSURFPlugin_Hypothesis::GetDefaultPreCADProcess3DTopology();
   int _precadDiscardInput       = BLSURFPlugin_Hypothesis::GetDefaultPreCADDiscardInput();
 
@@ -1012,6 +903,7 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp,
     _topology      = (int) hyp->GetTopology();
     // PreCAD
     _precadMergeEdges        = hyp->GetPreCADMergeEdges();
+    _precadRemoveDuplicateCADFaces = hyp->GetPreCADRemoveDuplicateCADFaces();
     _precadProcess3DTopology = hyp->GetPreCADProcess3DTopology();
     _precadDiscardInput      = hyp->GetPreCADDiscardInput();
 
@@ -1033,17 +925,15 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp,
     const BLSURFPlugin_Hypothesis::TOptionValues& preCADopts = hyp->GetPreCADOptionValues();
     for ( opIt = preCADopts.begin(); opIt != preCADopts.end(); ++opIt )
       if ( !opIt->second.empty() ) {
-        *use_precad = true;
-        MESSAGE("precad_set_param(): " << opIt->first << " = " << opIt->second);
-        precad_set_param(pcs, opIt->first.c_str(), opIt->second.c_str());
+        MESSAGE("cadsurf_set_param(): " << opIt->first << " = " << opIt->second);
+        set_param(css, opIt->first.c_str(), opIt->second.c_str());
       }
 
     const BLSURFPlugin_Hypothesis::TOptionValues& custom_preCADopts = hyp->GetCustomPreCADOptionValues();
     for ( opIt = custom_preCADopts.begin(); opIt != custom_preCADopts.end(); ++opIt )
       if ( !opIt->second.empty() ) {
-        *use_precad = true;
-        MESSAGE("precad_set_param(): " << opIt->first << " = " << opIt->second);
-        precad_set_param(pcs, opIt->first.c_str(), opIt->second.c_str());
+        MESSAGE("cadsurf_set_param(): " << opIt->first << " = " << opIt->second);
+        set_param(css, opIt->first.c_str(), opIt->second.c_str());
       }
   }
 //   else {
@@ -1058,14 +948,12 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp,
 //     MESSAGE("BLSURFPlugin_BLSURF::SetParameters using defaults");
 //   }
 
-  // PreCAD
-  if (_topology == BLSURFPlugin_Hypothesis::PreCAD) {
-    *use_precad = true;
-    precad_set_param(pcs, "verbose",                val_to_string(_verb).c_str());
-    precad_set_param(pcs, "merge_edges",            _precadMergeEdges ? "1" : "0");
-    precad_set_param(pcs, "process_3d_topology",    _precadProcess3DTopology ? "1" : "0");
-    precad_set_param(pcs, "discard_input_topology", _precadDiscardInput ? "1" : "0");
-  }
+  // PreProcessor (formerly PreCAD)
+  set_param(css, "merge_edges",            _precadMergeEdges ? "yes" : "no");
+  set_param(css, "remove_duplicate_cad_faces", _precadRemoveDuplicateCADFaces ? "yes" : "no");
+  set_param(css, "process_3d_topology",    _precadProcess3DTopology ? "1" : "0");
+  set_param(css, "discard_input_topology", _precadDiscardInput ? "1" : "0");
+
   // unlimit mesh size (issue 0022266)
   set_param(css, "max_number_of_points_per_patch", "1000000");
   
@@ -1417,36 +1305,15 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp,
     }
 
     MESSAGE("Setting Size Map on FACES ");
-// #if BLSURF_VERSION_LONG < "3.1.1"
-    cadsurf_data_set_sizemap_iso_cad_face(css, size_on_surface, &_smp_phy_size);
-// #else
-//     if (*use_precad)
-//       iso_sizemap_f = sizemap_new(c, distene_sizemap_type_iso_cad_face, (void *)size_on_surface, NULL);
-//     else
-//       clean_iso_sizemap_f = sizemap_new(c, distene_sizemap_type_iso_cad_face, (void *)size_on_surface, NULL);
-// #endif
+    cadsurf_set_sizemap_iso_cad_face(css, size_on_surface, &_smp_phy_size);
 
     if (HasSizeMapOnEdge){
       MESSAGE("Setting Size Map on EDGES ");
-// #if BLSURF_VERSION_LONG < "3.1.1"
-      cadsurf_data_set_sizemap_iso_cad_edge(css, size_on_edge, &_smp_phy_size);
-// #else
-//       if (*use_precad)
-//         iso_sizemap_e = sizemap_new(c, distene_sizemap_type_iso_cad_edge, (void *)size_on_edge, NULL);
-//       else
-//         clean_iso_sizemap_e = sizemap_new(c, distene_sizemap_type_iso_cad_edge, (void *)size_on_edge, NULL);
-// #endif
+      cadsurf_set_sizemap_iso_cad_edge(css, size_on_edge, &_smp_phy_size);
     }
     if (HasSizeMapOnVertex){
       MESSAGE("Setting Size Map on VERTICES ");
-// #if BLSURF_VERSION_LONG < "3.1.1"
-      cadsurf_data_set_sizemap_iso_cad_point(css, size_on_vertex, &_smp_phy_size);
-// #else
-//       if (*use_precad)
-//         iso_sizemap_p = sizemap_new(c, distene_sizemap_type_iso_cad_point, (void *)size_on_vertex, NULL);
-//       else
-//         clean_iso_sizemap_p = sizemap_new(c, distene_sizemap_type_iso_cad_point, (void *)size_on_vertex, NULL);
-// #endif
+      cadsurf_set_sizemap_iso_cad_point(css, size_on_vertex, &_smp_phy_size);
     }
   }
 
@@ -1455,9 +1322,6 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp,
    // reset vectors
    _preCadFacesIDsPeriodicityVector.clear();
    _preCadEdgesIDsPeriodicityVector.clear();
-   _facesIDsPeriodicityVector.clear();
-   _edgesIDsPeriodicityVector.clear();
-   _verticesIDsPeriodicityVector.clear();
 
   MESSAGE("SetParameters preCadFacesPeriodicityVector");
   const BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadFacesPeriodicityVector = BLSURFPlugin_Hypothesis::GetPreCadFacesPeriodicityVector(hyp);
@@ -1477,44 +1341,6 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp,
   }
   MESSAGE("_preCadEdgesIDsPeriodicityVector.size() = " << _preCadEdgesIDsPeriodicityVector.size());
 
-  if ( _preCadFacesIDsPeriodicityVector.size() > 0 || _preCadEdgesIDsPeriodicityVector.size() > 0 )
-    {
-      MESSAGE("USING PRECAD FOR PERIODICITY")
-      *use_precad = true;
-      precad_set_param(pcs, "verbose",                val_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].theFace1Entry, edgesPeriodicityVector[i].theEdge1Entry,
-        edgesPeriodicityVector[i].theFace2Entry, edgesPeriodicityVector[i].theEdge2Entry, 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].theEdge1Entry, verticesPeriodicityVector[i].theVertex1Entry,
-        verticesPeriodicityVector[i].theEdge2Entry, verticesPeriodicityVector[i].theVertex2Entry);
-  }
-  MESSAGE("_verticesIDsPeriodicityVector.size() = " << _verticesIDsPeriodicityVector.size());
 }
 
 //================================================================================
@@ -1556,21 +1382,15 @@ 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,
-                   cad_t *           cleanc,
-                   dcad_t *          cleandc)
+                   dcad_t *          dcad)
       : _ctx ( ctx  ),
         _css ( css  ),
         _cad ( cad  ),
-        _dcad( dcad ),
-        _cleanc( cleanc ),
-        _cleandc( cleandc )
+        _dcad( dcad )
     {
     }
     ~BLSURF_Cleaner()
@@ -1609,8 +1429,6 @@ 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;
@@ -2031,19 +1849,15 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh&         aMesh,
   // 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,cleanc,cleandc );
+  BLSURF_Cleaner cleaner( ctx,css,c,dcad );
 
   MESSAGE("BEGIN SetParameters");
   bool use_precad = false;
-  SetParameters(_hypothesis, css, pcs, aShape, &use_precad);
+  SetParameters(_hypothesis, css, aShape);
   MESSAGE("END SetParameters");
 
   MESSAGE("_preCadFacesIDsPeriodicityVector.size() = " << _preCadFacesIDsPeriodicityVector.size());
@@ -2636,139 +2450,16 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh&         aMesh,
     MESSAGE("END PRECAD EDGES PERIODICITY");
   }
 
-  if (! _facesIDsPeriodicityVector.empty()){
-    MESSAGE("INTO FACE PERIODICITY");
-    for (std::size_t i=0; i < _facesIDsPeriodicityVector.size(); i++){
-      int theFace1 = _facesIDsPeriodicityVector[i].first;
-      int theFace2 = _facesIDsPeriodicityVector[i].second;
-      MESSAGE("_facesIDsPeriodicityVector[" << i << "] = (" << theFace1 << ", " << theFace2 << ")");
-      status = cad_add_face_periodicity(c, theFace1, theFace2);
-      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 theFace1 = _edgesIDsPeriodicityVector[i].theFace1ID;
-      int theEdge1 = _edgesIDsPeriodicityVector[i].theEdge1ID;
-      int theFace2 = _edgesIDsPeriodicityVector[i].theFace2ID;
-      int theEdge2 = _edgesIDsPeriodicityVector[i].theEdge2ID;
-      int edge_orientation = _edgesIDsPeriodicityVector[i].edge_orientation;
-      MESSAGE("_edgesIDsPeriodicityVector[" << i << "] = (" << theFace1 << ", " << theEdge1 << ", " << theFace2 << ", " << theEdge2 << ", " << edge_orientation << ")");
-      status = cad_add_edge_periodicity(c, theFace1, theEdge1, theFace2, theEdge2, 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 theEdge1 = _verticesIDsPeriodicityVector[i].theEdge1ID;
-      int theVertex1 = _verticesIDsPeriodicityVector[i].theVertex1ID;
-      int theEdge2 = _verticesIDsPeriodicityVector[i].theEdge2ID;
-      int theVertex2 = _verticesIDsPeriodicityVector[i].theVertex2ID;
-      MESSAGE("_verticesIDsPeriodicityVector[" << i << "] = (" << theEdge1 << ", " << theVertex1 << ", " << theEdge2 << ", " << theVertex2 << ")");
-      status = cad_add_point_periodicity(c, theEdge1, theVertex1, theEdge2, theVertex2);
-      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){
-      // TODO: raise an error if status < 0.
-      cout << "================ WARNING =================== \n";
-      stringstream msg;
-      msg << "PreCAD processing failed with error code " << status << "\n";
-      msg << *mcud._error;
-      cout << msg.str();
-      cout << "============================================ \n";
-      // the text of _comment is set in message_cb by mcud->_error
-      // => No need to append msg to _comment
-      if (status > 0)
-        {
-          // TODO: fix the SIGSEGV of COMPERR_WARNING with 2 launches
-          error(COMPERR_WARNING, _comment);
-        }
-      if (status < 0)
-        {
-          error(_comment);
-        }
-    }
-    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 on cad \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) */
-      // //       if(geo_sizemap_e)
-      // //         clean_geo_sizemap_e = precad_new_sizemap(pcs, geo_sizemap_e);
-      // // 
-      // //       if(geo_sizemap_f)
-      // //         clean_geo_sizemap_f = precad_new_sizemap(pcs, geo_sizemap_f);
-      //
-      //       if(iso_sizemap_p)
-      //         clean_iso_sizemap_p = precad_new_sizemap(pcs, iso_sizemap_p);
-      //
-      //       if(iso_sizemap_e)
-      //         clean_iso_sizemap_e = precad_new_sizemap(pcs, iso_sizemap_e);
-      //
-      //       if(iso_sizemap_f)
-      //         clean_iso_sizemap_f = precad_new_sizemap(pcs, iso_sizemap_f);
-      // #endif
-    }
-    // Now we can delete the PreCAD session
-    precad_session_delete(pcs);
-  }
-
-  if (cleandc) {
-    cout << "Give the pre-processed dcad object to the current MG-CADSurf session \n";
-    cadsurf_data_set_dcad(css, cleandc);
-  }
-  else {
-    // Use the original one
-    cadsurf_data_set_dcad(css, dcad);
-  }
+  
+  // TODO: be able to use a mesh in input.
+  // See imsh usage in Products/templates/mg-cadsurf_template_common.cpp
+  // => cadsurf_set_mesh
+    
+  // Use the original dcad
+  cadsurf_set_dcad(css, dcad);
 
-  if (cleanc) {
-    // Give the pre-processed CAD object to the current MG-CADSurf session
-    cout << "Give the pre-processed CAD object to the current MG-CADSurf session \n";
-    cadsurf_data_set_cad(css, cleanc);
-  }
-  else {
-    // Use the original one
-    cadsurf_data_set_cad(css, c);
-  }
+  // Use the original cad
+  cadsurf_set_cad(css, c);
 
   std::cout << std::endl;
   std::cout << "Beginning of Surface Mesh generation" << std::endl;
@@ -2800,10 +2491,10 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh&         aMesh,
   std::cout << std::endl;
 
   mesh_t *msh = NULL;
-  cadsurf_data_get_mesh(css, &msh);
+  cadsurf_get_mesh(css, &msh);
   if(!msh){
     /* release the mesh object */
-    cadsurf_data_regain_mesh(css, msh);
+    cadsurf_regain_mesh(css, msh);
     return error(_comment);
   }
 
@@ -3059,7 +2750,7 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh&         aMesh,
   }
 
   /* release the mesh object, the rest is released by cleaner */
-  cadsurf_data_regain_mesh(css, msh);
+  cadsurf_regain_mesh(css, msh);
 
   if ( needMerge ) // sew mesh computed by MG-CADSurf with pre-existing mesh
   {
index 4b7cd5cfb94f191da6fff330e2c391ad0d9ef8f3..1a9833216b23a604d53e8e987030828a26c06d21 100644 (file)
@@ -62,7 +62,6 @@
 extern "C"{
 #include <meshgems/meshgems.h>
 #include <meshgems/cadsurf.h>
-#include <meshgems/precad.h>
 }
 
 #include <BRepClass_FaceClassifier.hxx>
@@ -84,7 +83,7 @@ class BLSURFPlugin_BLSURF: public SMESH_2D_Algo {
                                  const TopoDS_Shape&                  aShape,
                                  SMESH_Hypothesis::Hypothesis_Status& aStatus);
 
-    void SetParameters(const BLSURFPlugin_Hypothesis* hyp, blsurf_session_t *bls, precad_session_t *pcs, const TopoDS_Shape& shape, bool *use_precad);
+    void SetParameters(const BLSURFPlugin_Hypothesis* hyp, cadsurf_session_t *css, const TopoDS_Shape& shape);
 
     virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape);
 
@@ -137,10 +136,6 @@ class BLSURFPlugin_BLSURF: public SMESH_2D_Algo {
     TPreCadIDsPeriodicityVector _preCadFacesIDsPeriodicityVector;
     TPreCadIDsPeriodicityVector _preCadEdgesIDsPeriodicityVector;
 
-    TShapesIDsPeriodicityVector _facesIDsPeriodicityVector;
-    TEdgesIDsPeriodicityVector _edgesIDsPeriodicityVector;
-    TVerticesIDsPeriodicityVector _verticesIDsPeriodicityVector;
-
   private:
     bool compute(SMESH_Mesh&          aMesh,
                  const TopoDS_Shape&  aShape,
@@ -156,11 +151,6 @@ class BLSURFPlugin_BLSURF: public SMESH_2D_Algo {
     void createEnforcedVertexOnFace(TopoDS_Shape FaceShape, BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList);
     void createPreCadFacesPeriodicity(TopoDS_Shape theGeomShape, const BLSURFPlugin_Hypothesis::TPreCadPeriodicity &preCadPeriodicity);
     void createPreCadEdgesPeriodicity(TopoDS_Shape theGeomShape, const BLSURFPlugin_Hypothesis::TPreCadPeriodicity &preCadPeriodicity);
-    void createFacesPeriodicity(TopoDS_Shape theGeomShape, BLSURFPlugin_Hypothesis::TEntry theFace1,  BLSURFPlugin_Hypothesis::TEntry theFace2);
-    void createEdgesPeriodicity(TopoDS_Shape theGeomShape, BLSURFPlugin_Hypothesis::TEntry theFace1, BLSURFPlugin_Hypothesis::TEntry theEdge1,
-        BLSURFPlugin_Hypothesis::TEntry theFace2, BLSURFPlugin_Hypothesis::TEntry theEdge2, int edge_orientation = 0);
-    void createVerticesPeriodicity(TopoDS_Shape theGeomShape, BLSURFPlugin_Hypothesis::TEntry theEdge1, BLSURFPlugin_Hypothesis::TEntry theVertex1,
-        BLSURFPlugin_Hypothesis::TEntry theEdge2, BLSURFPlugin_Hypothesis::TEntry theVertex2);
     void Set_NodeOnEdge(SMESHDS_Mesh* meshDS, const 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 607bf095150a81edba42ae9b12e757bb94ae8129..aad7b60e90a3d15e3a65c2229882f54412c2a8a8 100644 (file)
@@ -65,6 +65,7 @@ BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_G
   _verb(GetDefaultVerbosity()),
   _topology(GetDefaultTopology()),
   _preCADMergeEdges(GetDefaultPreCADMergeEdges()),
+  _preCADRemoveDuplicateCADFaces(GetDefaultPreCADRemoveDuplicateCADFaces()),
   _preCADProcess3DTopology(GetDefaultPreCADProcess3DTopology()),
   _preCADDiscardInput(GetDefaultPreCADDiscardInput()),
   _sizeMap(GetDefaultSizeMap()),
@@ -391,6 +392,15 @@ void BLSURFPlugin_Hypothesis::SetPreCADMergeEdges(bool theVal) {
   }
 }
 
+//=============================================================================
+void BLSURFPlugin_Hypothesis::SetPreCADRemoveDuplicateCADFaces(bool theVal) {
+  if (theVal != _preCADRemoveDuplicateCADFaces) {
+//     SetTopology(PreCAD);
+    _preCADRemoveDuplicateCADFaces = theVal;
+    NotifySubMeshesHypothesisModification();
+  }
+}
+
 //=============================================================================
 void BLSURFPlugin_Hypothesis::SetPreCADProcess3DTopology(bool theVal) {
   if (theVal != _preCADProcess3DTopology) {
@@ -1359,58 +1369,6 @@ void BLSURFPlugin_Hypothesis::AddPreCadEdgesPeriodicity(TEntry theEdge1Entry, TE
   NotifySubMeshesHypothesisModification();
 }
 
-//=======================================================================
-//function : AddFacePeriodicity
-//=======================================================================
-void BLSURFPlugin_Hypothesis::AddFacePeriodicity(TEntry theFace1Entry, TEntry theFace2Entry) {
-
-  std::pair< TEntry, TEntry > pairOfFacesEntries = std::make_pair(theFace1Entry, theFace2Entry);
-
-  _facesPeriodicityVector.push_back(pairOfFacesEntries);
-
-  // Removed for performance reason since AddFacePeriodicity is called multiple times (one time for each face)
-  // Does not affect the behaviour since it is only called via python, not via GUI.
-  //NotifySubMeshesHypothesisModification();
-}
-
-
-//=======================================================================
-//function : AddEdgePeriodicity
-//=======================================================================
-void BLSURFPlugin_Hypothesis::AddEdgePeriodicity(TEntry theFace1Entry, TEntry theEdge1Entry, TEntry theFace2Entry, TEntry theEdge2Entry, int edge_orientation) {
-
-  TEdgePeriodicity edgePeriodicity;
-  edgePeriodicity.theFace1Entry = theFace1Entry;
-  edgePeriodicity.theEdge1Entry = theEdge1Entry;
-  edgePeriodicity.theFace2Entry = theFace2Entry;
-  edgePeriodicity.theEdge2Entry = theEdge2Entry;
-  edgePeriodicity.edge_orientation = edge_orientation;
-
-  _edgesPeriodicityVector.push_back(edgePeriodicity);
-
-  // Removed for performance reason since AddEdgePeriodicity is called multiple times (one time for each edge)
-  // Does not affect the behaviour since it is only called via python, not via GUI.
-  //NotifySubMeshesHypothesisModification();
-}
-
-//=======================================================================
-//function : AddVertexPeriodicity
-//=======================================================================
-void BLSURFPlugin_Hypothesis::AddVertexPeriodicity(TEntry theEdge1Entry, TEntry theVertex1Entry, TEntry theEdge2Entry, TEntry theVertex2Entry) {
-
-  TVertexPeriodicity vertexPeriodicity;
-  vertexPeriodicity.theEdge1Entry = theEdge1Entry;
-  vertexPeriodicity.theVertex1Entry = theVertex1Entry;
-  vertexPeriodicity.theEdge2Entry = theEdge2Entry;
-  vertexPeriodicity.theVertex2Entry = theVertex2Entry;
-
-  _verticesPeriodicityVector.push_back(vertexPeriodicity);
-
-  // Removed for performance reason since AddVertexPeriodicity is called multiple times (one time for each vertex)
-  // Does not affect the behaviour since it is only called via python, not via GUI.
-  //NotifySubMeshesHypothesisModification();
-}
-
 //=============================================================================
 std::ostream & BLSURFPlugin_Hypothesis::SaveTo(std::ostream & save) {
    // We must keep at least the same number of arguments when increasing the SALOME version
@@ -1449,7 +1407,7 @@ std::ostream & BLSURFPlugin_Hypothesis::SaveTo(std::ostream & save) {
   save << " " << (int) _phySizeRel << " " << (int) _minSizeRel << " " << (int) _maxSizeRel << " " << _chordalError ;
   save << " " << (int) _anisotropic << " " << _anisotropicRatio << " " << (int) _removeTinyEdges << " " << _tinyEdgeLength ;
   save << " " << (int) _badElementRemoval << " " << _badElementAspectRatio << " " << (int) _optimizeMesh << " " << (int) _quadraticMesh ;
-  save << " " << (int) _preCADProcess3DTopology;
+  save << " " << (int) _preCADProcess3DTopology << " " << (int) _preCADRemoveDuplicateCADFaces;
 
   op_val = _option2value.begin();
   if (op_val != _option2value.end()) {
@@ -1987,6 +1945,12 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
     else
       load.clear(std::ios::badbit | load.rdstate());
 
+    isOK = static_cast<bool>(load >> i);
+    if (isOK)
+      _preCADRemoveDuplicateCADFaces = (bool) i;
+    else
+      load.clear(std::ios::badbit | load.rdstate());
+
   }
   
 
index bd0ba59f98ccabd19318e395ede4cf19a68f0698..0988a6e3008b8f93197e822df6278b2f9552546d 100644 (file)
@@ -134,6 +134,9 @@ public:
   void SetPreCADMergeEdges(bool theVal);
   bool GetPreCADMergeEdges() const { return _preCADMergeEdges; }
 
+  void SetPreCADRemoveDuplicateCADFaces(bool theVal);
+  bool GetPreCADRemoveDuplicateCADFaces() const { return _preCADRemoveDuplicateCADFaces; }
+
   void SetPreCADProcess3DTopology(bool theVal);
   bool GetPreCADProcess3DTopology() const { return _preCADProcess3DTopology; }
 
@@ -365,8 +368,9 @@ public:
   static int             GetDefaultVerbosity() { return 3; }
   static Topology        GetDefaultTopology() { return FromCAD; }
   // PreCAD
-  static bool            GetDefaultPreCADMergeEdges() { return true; }
-  static bool            GetDefaultPreCADProcess3DTopology() { return true; }
+  static bool            GetDefaultPreCADMergeEdges() { return false; }
+  static bool            GetDefaultPreCADRemoveDuplicateCADFaces() { return false; }
+  static bool            GetDefaultPreCADProcess3DTopology() { return false; }
   static bool            GetDefaultPreCADDiscardInput() { return false; }
   
   static TSizeMap        GetDefaultSizeMap() { return TSizeMap();}
@@ -416,10 +420,6 @@ public:
   void AddPreCadEdgesPeriodicity(TEntry theEdge1Entry, TEntry theEdge2Entry,
       std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);
 
-  void AddFacePeriodicity(TEntry theFace1Entry, TEntry theFace2Entry);
-  void AddEdgePeriodicity(TEntry theFace1Entry, TEntry theEdge1Entry, TEntry theFace2Entry, TEntry theEdge2Entry, int edge_orientation = 0);
-  void AddVertexPeriodicity(TEntry theEdge1Entry, TEntry theVertex1Entry, TEntry theEdge2Entry, TEntry theVertex2Entry);
-
   static double undefinedDouble() { return -1.0; }
 
   typedef std::map< std::string, std::string > TOptionValues;
@@ -496,6 +496,7 @@ private:
   Topology        _topology;
   
   bool            _preCADMergeEdges;
+  bool            _preCADRemoveDuplicateCADFaces;
   bool            _preCADProcess3DTopology;
   bool            _preCADDiscardInput;
   double          _preCADEpsNano;
index 07daee8160cdc5c6e626fd969d1e74a4b62ba6e8..a8f3cd064a9bce8bfdf9a840e6b2f3b043e49141 100644 (file)
@@ -644,6 +644,34 @@ CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges() {
   return this->GetImpl()->GetPreCADMergeEdges();
 }
 
+//=============================================================================
+/*!
+ *  BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces
+ *
+ *  Set true or false
+ */
+//=============================================================================
+void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue) {
+  // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces");
+  ASSERT(myBaseImpl);
+  this->GetImpl()->SetPreCADRemoveDuplicateCADFaces(theValue);
+  std::string theValueStr = theValue ? "True" : "False";
+  SMESH::TPythonDump() << _this() << ".SetPreCADRemoveDuplicateCADFaces( " << theValueStr.c_str() << " )";
+}
+
+//=============================================================================
+/*!
+ *  BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces
+ *
+ *  Get true or false
+ */
+//=============================================================================
+CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces() {
+  // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces");
+  ASSERT(myBaseImpl);
+  return this->GetImpl()->GetPreCADRemoveDuplicateCADFaces();
+}
+
 //=============================================================================
 /*!
  *  BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology
@@ -3070,165 +3098,6 @@ void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEd
   MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry END");
 }
 
-void BLSURFPlugin_Hypothesis_i::AddFacePeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
-    throw (SALOME::SALOME_Exception)
-{
-  ASSERT(myBaseImpl);
-
-  string prefix1 = "Source_face_";
-  CheckShapeType(theFace1, GEOM::FACE);
-  string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
-  string prefix2 = "Target_face_";
-  CheckShapeType(theFace2, GEOM::FACE);
-  string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
-
-  MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
-  MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
-  MESSAGE("IDL : AddFacePeriodicity( "<< theFace1Entry << ", " << theFace2Entry << ")");
-  try {
-      AddFacePeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str());
-  } catch (SALOME_Exception& ex) {
-    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
-  }
-
-
-}
-
-void BLSURFPlugin_Hypothesis_i::AddFacePeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry)
-    throw (SALOME::SALOME_Exception){
-
-  ASSERT(myBaseImpl);
-
-  MESSAGE("IDL : AddFacePeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << ")");
-  this->GetImpl()->AddFacePeriodicity(theFace1Entry, theFace2Entry);
-  SMESH::TPythonDump pd;
-  pd << _this() << ".AddFacePeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
-  MESSAGE("IDL : AddFacePeriodicityEntry END");
-}
-
-
-void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theEdge1,
-                                                   GEOM::GEOM_Object_ptr theFace2, GEOM::GEOM_Object_ptr theEdge2,
-                                                   CORBA::Long edge_orientation)
-    throw (SALOME::SALOME_Exception){
-  ASSERT(myBaseImpl);
-
-  string prefix_theFace1 = "Source_face_";
-  CheckShapeType(theFace1, GEOM::FACE);
-  string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix_theFace1);
-  string prefix_theFace2 = "Target_face_";
-  CheckShapeType(theFace2, GEOM::FACE);
-  string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix_theFace2);
-
-  string prefix_theEdge1 = "Source_edge_";
-  CheckShapeType(theEdge1, GEOM::EDGE);
-  string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1);
-  string prefix_theEdge2 = "Target_edge_";
-  CheckShapeType(theEdge2, GEOM::EDGE);
-  string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2);
-
-  MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
-  MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
-  MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
-  MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
-  MESSAGE("IDL : AddEdgePeriodicity( "<< theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", "  << theEdge2Entry << ", " << edge_orientation << ")");
-  try {
-      AddEdgePeriodicityEntry(theFace1Entry.c_str(), theEdge1Entry.c_str(), theFace2Entry.c_str(), theEdge2Entry.c_str(), edge_orientation);
-  } catch (SALOME_Exception& ex) {
-    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
-  }
-
-
-}
-
-void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicityWithoutFaces(GEOM::GEOM_Object_ptr theEdge1,
-                                                               GEOM::GEOM_Object_ptr theEdge2,
-                                                               CORBA::Long edge_orientation)
-    throw (SALOME::SALOME_Exception){
-  ASSERT(myBaseImpl);
-
-  string theFace1Entry = "";
-  string theFace2Entry = "";
-
-  string prefix_theEdge1 = "Source_edge_";
-  CheckShapeType(theEdge1, GEOM::EDGE);
-  string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1);
-  string prefix_theEdge2 = "Target_edge_";
-  CheckShapeType(theEdge2, GEOM::EDGE);
-  string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2);
-
-  MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
-  MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
-  MESSAGE("IDL : AddEdgePeriodicity( "<< theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", "  << theEdge2Entry << ", " << edge_orientation << ")");
-  try {
-      AddEdgePeriodicityEntry(theFace1Entry.c_str(), theEdge1Entry.c_str(), theFace2Entry.c_str(), theEdge2Entry.c_str(), edge_orientation);
-  } catch (SALOME_Exception& ex) {
-    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
-  }
-
-
-}
-
-void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicityEntry(const char* theFace1Entry, const char* theEdge1Entry, const char* theFace2Entry, const char* theEdge2Entry, const long edge_orientation)
-    throw (SALOME::SALOME_Exception){
-
-  ASSERT(myBaseImpl);
-
-  MESSAGE("IDL : AddEdgePeriodicityEntry(" << theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", "  << theEdge2Entry << ", " << edge_orientation << ")");
-  this->GetImpl()->AddEdgePeriodicity(theFace1Entry, theEdge1Entry, theFace2Entry, theEdge2Entry, edge_orientation);
-  SMESH::TPythonDump pd;
-  if (theFace1Entry)
-    pd << _this() << ".AddEdgePeriodicity(" << theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", "  << theEdge2Entry << ", " << edge_orientation <<")";
-  else
-    pd << _this() << ".AddEdgePeriodicityWithoutFaces(" << theEdge1Entry << ", " << theEdge2Entry << ", " << edge_orientation <<")";
-  MESSAGE("IDL : AddEdgePeriodicityEntry END");
-}
-
-void BLSURFPlugin_Hypothesis_i::AddVertexPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theVertex1,
-    GEOM::GEOM_Object_ptr theEdge2, GEOM::GEOM_Object_ptr theVertex2)
-    throw (SALOME::SALOME_Exception){
-  ASSERT(myBaseImpl);
-
-  string prefix_theEdge1 = "Source_edge_";
-  CheckShapeType(theEdge1, GEOM::EDGE);
-  string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1);
-  string prefix_theEdge2 = "Target_edge_";
-  CheckShapeType(theEdge2, GEOM::EDGE);
-  string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2);
-
-  string prefix_theVertex1 = "Source_vertex_";
-  CheckShapeType(theVertex1, GEOM::VERTEX);
-  string theVertex1Entry = PublishIfNeeded(theVertex1, GEOM::VERTEX, prefix_theVertex1);
-  string prefix_theVertex2 = "Target_vertex_";
-  CheckShapeType(theVertex2, GEOM::VERTEX);
-  string theVertex2Entry = PublishIfNeeded(theVertex2, GEOM::VERTEX, prefix_theVertex2);
-
-  MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
-  MESSAGE("IDL : theVertex1->GetName : " << theVertex1->GetName());
-  MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
-  MESSAGE("IDL : theVertex2->GetName : " << theVertex2->GetName());
-  MESSAGE("IDL : AddVertexPeriodicity( "<< theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", "  << theVertex2Entry << ")");
-  try {
-      AddVertexPeriodicityEntry(theEdge1Entry.c_str(), theVertex1Entry.c_str(), theEdge2Entry.c_str(), theVertex2Entry.c_str());
-  } catch (SALOME_Exception& ex) {
-    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
-  }
-
-
-}
-
-void BLSURFPlugin_Hypothesis_i::AddVertexPeriodicityEntry(const char* theEdge1Entry, const char* theVertex1Entry, const char* theEdge2Entry, const char* theVertex2Entry)
-    throw (SALOME::SALOME_Exception){
-
-  ASSERT(myBaseImpl);
-
-  MESSAGE("IDL : AddVertexPeriodicityEntry(" << theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", "  << theVertex2Entry << ")");
-  this->GetImpl()->AddVertexPeriodicity(theEdge1Entry, theVertex1Entry, theEdge2Entry, theVertex2Entry);
-  SMESH::TPythonDump pd;
-  pd << _this() << ".AddVertexPeriodicity(" << theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", "  << theVertex2Entry << ")";
-  MESSAGE("IDL : AddVertexPeriodicityEntry END");
-}
-
 
 //================================================================================
 /*!
index ead28e423b1c1f63ea465b4eda66eb0bedb42474..2d7de6c32cfd00be560b824e63c2f17ec189b8f2 100644 (file)
@@ -111,6 +111,9 @@ public:
   void SetPreCADMergeEdges(CORBA::Boolean theValue);
   CORBA::Boolean GetPreCADMergeEdges();
 
+  void SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue);
+  CORBA::Boolean GetPreCADRemoveDuplicateCADFaces();
+
   void SetPreCADProcess3DTopology(CORBA::Boolean theValue);
   CORBA::Boolean GetPreCADProcess3DTopology();
 
@@ -294,29 +297,6 @@ public:
       const BLSURFPlugin::TEntryList& theSourceVerticesEntries, const BLSURFPlugin::TEntryList& theTargetVerticesEntries)
       throw (SALOME::SALOME_Exception);
 
-  void AddFacePeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
-      throw (SALOME::SALOME_Exception);
-
-  void AddFacePeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry)
-    throw (SALOME::SALOME_Exception);
-
-  void AddEdgePeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theEdge1,
-                          GEOM::GEOM_Object_ptr theFace2, GEOM::GEOM_Object_ptr theEdge2, CORBA::Long edge_orientation = 0)
-      throw (SALOME::SALOME_Exception);
-
-  void AddEdgePeriodicityWithoutFaces(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2, CORBA::Long edge_orientation = 0)
-      throw (SALOME::SALOME_Exception);
-
-  void AddEdgePeriodicityEntry(const char* theFace1Entry, const char* theEdge1Entry, const char* theFace2Entry, const char* theEdge2Entry, const long edge_orientation = 0)
-    throw (SALOME::SALOME_Exception);
-
-  void AddVertexPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theVertex1,
-      GEOM::GEOM_Object_ptr theEdge2, GEOM::GEOM_Object_ptr theVertex2)
-      throw (SALOME::SALOME_Exception);
-
-  void AddVertexPeriodicityEntry(const char* theEdge1Entry, const char* theVertex1Entry, const char* theEdge2Entry, const char* theVertex2Entry)
-    throw (SALOME::SALOME_Exception);
-
   ///////////////////////
   
   /*!
index 613e221a1272e1b8b7c14d7b0cbde9c93885b90e..76d39354ca683925a37854013254de8e9b22b440 100644 (file)
@@ -6,7 +6,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>646</width>
+    <width>653</width>
     <height>226</height>
    </rect>
   </property>
@@ -16,7 +16,7 @@
      <property name="orientation">
       <enum>Qt::Horizontal</enum>
      </property>
-     <widget class="QWidget" name="">
+     <widget class="QWidget" name="layoutWidget">
       <layout class="QGridLayout" name="gridLayout_3">
        <item row="0" column="0" colspan="2">
         <widget class="QTableWidget" name="myOptionTable">
@@ -70,7 +70,7 @@
        </item>
       </layout>
      </widget>
-     <widget class="QWidget" name="">
+     <widget class="QWidget" name="layoutWidget">
       <layout class="QGridLayout" name="gridLayout_2">
        <property name="topMargin">
         <number>0</number>
@@ -81,7 +81,7 @@
           <string>BLSURF_PRECAD_GROUP</string>
          </property>
          <property name="checkable">
-          <bool>true</bool>
+          <bool>false</bool>
          </property>
          <property name="checked">
           <bool>false</bool>
             </property>
            </widget>
           </item>
+          <item row="3" column="0" colspan="2">
+           <widget class="QCheckBox" name="myPreCADRemoveDuplicateCADFaces">
+            <property name="text">
+             <string>BLSURF_PRECAD_REMOVE_DUPLICATE_CAD_FACES</string>
+            </property>
+            <property name="checked">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
          </layout>
         </widget>
        </item>
   <tabstop>rmBtn</tabstop>
   <tabstop>myPreCADGroupBox</tabstop>
   <tabstop>myPreCADMergeEdges</tabstop>
+  <tabstop>myPreCADRemoveDuplicateCADFaces</tabstop>
   <tabstop>myPreCADProcess3DTopology</tabstop>
   <tabstop>myPreCADDiscardInput</tabstop>
   <tabstop>myVerbosity</tabstop>
index 1fe4352a45513f9aad72aba42aa9018a6320f32e..18eec6460952cc342379d0bc6aed1b63d2eaebef 100644 (file)
@@ -1835,6 +1835,7 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const
   myAdvWidget->myVerbosity->setValue( data.myVerbosity );
   myAdvWidget->myPreCADGroupBox->setChecked(data.myTopology == PreCAD);
   myAdvWidget->myPreCADMergeEdges->setChecked( data.myPreCADMergeEdges );
+  myAdvWidget->myPreCADRemoveDuplicateCADFaces->setChecked( data.myPreCADRemoveDuplicateCADFaces );
   myAdvWidget->myPreCADProcess3DTopology->setChecked( data.myPreCADProcess3DTopology );
   myAdvWidget->myPreCADDiscardInput->setChecked( data.myPreCADDiscardInput );
 
@@ -2065,6 +2066,7 @@ bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData
   h_data.myVerbosity              = h->GetVerbosity();
   h_data.myTopology               = (int) h->GetTopology();
   h_data.myPreCADMergeEdges       = h->GetPreCADMergeEdges();
+  h_data.myPreCADRemoveDuplicateCADFaces = h->GetPreCADRemoveDuplicateCADFaces();
   h_data.myPreCADProcess3DTopology  = h->GetPreCADProcess3DTopology();
   h_data.myPreCADDiscardInput     = h->GetPreCADDiscardInput();
 
@@ -2332,6 +2334,8 @@ bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesi
       h->SetTopology( (int) h_data.myTopology );
     if ( h->GetPreCADMergeEdges() != h_data.myPreCADMergeEdges )
       h->SetPreCADMergeEdges( h_data.myPreCADMergeEdges );
+    if ( h->GetPreCADRemoveDuplicateCADFaces() != h_data.myPreCADRemoveDuplicateCADFaces )
+      h->SetPreCADRemoveDuplicateCADFaces( h_data.myPreCADRemoveDuplicateCADFaces );
     if ( h->GetPreCADProcess3DTopology() != h_data.myPreCADProcess3DTopology )
       h->SetPreCADProcess3DTopology( h_data.myPreCADProcess3DTopology );
     if ( h->GetPreCADDiscardInput() != h_data.myPreCADDiscardInput )
@@ -2528,6 +2532,7 @@ QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothes
   h_data.myVerbosity             = myAdvWidget->myVerbosity->value();
   h_data.myTopology              = myAdvWidget->myPreCADGroupBox->isChecked() ? PreCAD : FromCAD;
   h_data.myPreCADMergeEdges      = myAdvWidget->myPreCADMergeEdges->isChecked();
+  h_data.myPreCADRemoveDuplicateCADFaces = myAdvWidget->myPreCADRemoveDuplicateCADFaces->isChecked();
   h_data.myPreCADProcess3DTopology = myAdvWidget->myPreCADProcess3DTopology->isChecked();
   h_data.myPreCADDiscardInput    = myAdvWidget->myPreCADDiscardInput->isChecked();
 
@@ -2558,6 +2563,7 @@ QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothes
   
   guiHyp += tr("BLSURF_TOPOLOGY") + " = " + QString::number( h_data.myTopology ) + "; ";
   guiHyp += tr("BLSURF_PRECAD_MERGE_EDGES") + " = " + QString(h_data.myPreCADMergeEdges ? "yes" : "no") + "; ";
+  guiHyp += tr("BLSURF_PRECAD_REMOVE_DUPLICATE_CAD_FACES") + " = " + QString(h_data.myPreCADRemoveDuplicateCADFaces ? "yes" : "no") + "; ";
   guiHyp += tr("BLSURF_PRECAD_REMOVE_NANO_EDGES") + " = " + QString(h_data.myPreCADProcess3DTopology ? "yes" : "no") + "; ";
   guiHyp += tr("BLSURF_PRECAD_DISCARD_INPUT") + " = " + QString(h_data.myPreCADDiscardInput ? "yes" : "no") + "; ";
 
index 48f86750aa51619d904cdcd80a7caf099ac8fe52..f2dc0ed48b1181a43574e7b44e98544e3945190f 100644 (file)
@@ -169,7 +169,7 @@ typedef struct
   double  myAnisotropicRatio, myTinyEdgeLength, myBadElementAspectRatio;
   bool    myOptimizeMesh, myQuadraticMesh;
   bool    myAllowQuadrangles, mySmpsurface,mySmpedge,mySmppoint,myEnforcedVertex,myInternalEnforcedVerticesAllFaces;
-  bool    myPreCADMergeEdges, myPreCADProcess3DTopology, myPreCADDiscardInput;
+  bool    myPreCADMergeEdges, myPreCADRemoveDuplicateCADFaces, myPreCADProcess3DTopology, myPreCADDiscardInput;
 //   bool    myGMFFileMode;
   std::string myGMFFileName, myInternalEnforcedVerticesAllFacesGroup;
   TEnfVertexList enfVertexList;
index 2db2607b4277e4110f868e61c8dfb8115bcc265c..4c51af917264b97eec8570473432bd779178fb78 100644 (file)
@@ -250,6 +250,10 @@ The smaller this distance is, the closer the mesh is to the exact surface (only
         <source>BLSURF_PRECAD_MERGE_EDGES</source>
         <translation>Merge edges</translation>
     </message>
+    <message>
+        <source>BLSURF_PRECAD_REMOVE_DUPLICATE_CAD_FACES</source>
+        <translation>Remove duplicate CAD Faces</translation>
+    </message>
     <message>
         <source>BLSURF_PRECAD_PROCESS_3D_TOPOLOGY</source>
         <translation>Process 3D topology</translation>
index 6bc4feb085eb252238b74f734e66218979b72e06..e8e71d5a440a49a31bf6eed79f16c778ba26c451 100755 (executable)
@@ -254,6 +254,10 @@ Plus la distance est petite, plus le maillage sera proche de la surface (disponi
         <source>BLSURF_PRECAD_MERGE_EDGES</source>
         <translation>Fusionner des arĂȘtes</translation>
     </message>
+    <message>
+        <source>BLSURF_PRECAD_REMOVE_DUPLICATE_CAD_FACES</source>
+        <translation>Supprime les faces CAO en double</translation>
+    </message>
     <message>
         <source>BLSURF_PRECAD_PROCESS_3D_TOPOLOGY</source>
         <translation>Nettoyer la CAO</translation>
diff --git a/tests/test_periodicity.py b/tests/test_periodicity.py
deleted file mode 100644 (file)
index 2828322..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-# -*- coding: utf-8 -*-
-
-import salome
-
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
-
-import math
-
-simple = False
-
-r = 10
-dist = 10
-
-p1 = geompy.MakeVertex(0., 0., 0.)
-p2 = geompy.MakeVertex(100., 100., 100.)
-box = geompy.MakeBoxTwoPnt(p1, p2)
-geompy.addToStudy(box, "box")
-
-p3 = geompy.MakeVertex(25., 5., 25.)
-sphere1 = geompy.MakeSpherePntR(p3, 15.)
-geompy.addToStudy(sphere1, "sphere1")
-
-sphere1_trans = geompy.MakeTranslation(sphere1, 0, 100, 0)
-geompy.addToStudy(sphere1_trans, "sphere1_trans")
-
-sphere1_trans = geompy.MakeTranslation(sphere1, 0, 100, 0)
-geompy.addToStudy(sphere1_trans, "sphere1_trans")
-
-p4 = geompy.MakeVertex(5, 50, 90)
-sphere2 = geompy.MakeSpherePntR(p4, 20.)
-
-sphere2_trans = geompy.MakeTranslation(sphere2, 100, 0, 0)
-geompy.addToStudy(sphere2_trans, "sphere2_trans")
-
-sphere2_trans2 = geompy.MakeTranslation(sphere2, 0, 0, -100)
-geompy.addToStudy(sphere2_trans2, "sphere2_trans2")
-
-sphere2_trans3 = geompy.MakeTranslation(sphere2, 100, 0, -100)
-geompy.addToStudy(sphere2_trans3, "sphere2_trans3")
-
-if simple:
-    part = box
-else:
-    part = geompy.MakePartition([box], [sphere1, sphere1_trans, sphere2, sphere2_trans, sphere2_trans2, sphere2_trans3])
-geompy.addToStudy(part, "part")
-
-Vx = geompy.MakeVectorDXDYDZ(1, 0, 0)
-Vy = geompy.MakeVectorDXDYDZ(0, 1, 0)
-Vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
-
-left_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vy, GEOM.ST_ON)
-left = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(left, left_faces)
-geompy.addToStudyInFather(part, left, "left")
-
-right_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vy, p2, GEOM.ST_ON)
-right = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(right, right_faces)
-geompy.addToStudyInFather(part, right, "right")
-
-back_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vx, GEOM.ST_ON)
-back = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(back, back_faces)
-geompy.addToStudyInFather(part, back, "back")
-
-front_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vx, p2, GEOM.ST_ON)
-front = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(front, front_faces)
-geompy.addToStudyInFather(part, front, "front")
-
-bottom_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vz, GEOM.ST_ON)
-bottom = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(bottom, bottom_faces)
-geompy.addToStudyInFather(part, bottom, "bottom")
-
-top_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vz, p2, GEOM.ST_ON)
-top = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(top, top_faces)
-geompy.addToStudyInFather(part, top, "top")
-
-sources = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(sources, left_faces)
-geompy.UnionList(sources, back_faces)
-geompy.UnionList(sources, top_faces)
-geompy.addToStudyInFather(part, sources, "sources")
-
-
-# Mesh
-# ====
-
-import SMESH
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
-
-from salome.BLSURFPlugin import BLSURFPluginBuilder
-
-Mesh = smesh.Mesh(part, "Mesh")
-
-algo2d = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf)
-algo2d.SetGeometricMesh( 1 )
-algo2d.SetAngleMesh( 4 )
-algo2d.SetPhySize( 8 )
-algo2d.SetOptionValue( 'periodic_tolerance', '1e-2' )
-# Deactivate PreCAD
-algo2d.SetTopology(BLSURFPluginBuilder.FromCAD)
-
-def proj_x(shape1):
-    shape2 = geompy.MakeTranslation(shape1, 100, 0., 0)
-    return shape2
-    
-def proj_y(shape1):
-    shape2 = geompy.MakeTranslation(shape1, 0, 100., 0)
-    return shape2
-
-def proj_z(shape1):
-    shape2 = geompy.MakeTranslation(shape1, 0, 0, 100.)
-    return shape2
-
-algo2d.AddAdvancedFacesPeriodicity(back, front, proj_x)
-algo2d.AddAdvancedFacesPeriodicity(left, right, proj_y)
-algo2d.AddAdvancedFacesPeriodicity(bottom, top, proj_z)
-
-gr_left = Mesh.Group(left)
-gr_right = Mesh.Group(right)
-gr_front = Mesh.Group(front)
-gr_back = Mesh.Group(back)
-gr_bottom = Mesh.Group(bottom)
-gr_top = Mesh.Group(top)
-
-Mesh.Compute()
-
-left_translated = Mesh.TranslateObjectMakeMesh( gr_left, SMESH.DirStruct( SMESH.PointStruct ( 0, 100, 0 )), 0, 'left_translated' )
-front_translated = Mesh.TranslateObjectMakeMesh( gr_front, SMESH.DirStruct( SMESH.PointStruct ( -100, 0, 0 )), 0, 'front_translated' )
-bottom_translated = Mesh.TranslateObjectMakeMesh( gr_bottom, SMESH.DirStruct( SMESH.PointStruct ( 0, 0, 100 )), 0, 'bottom_translated' )
-
-def checkProjection(gr, mesh_translated, tol=1e-7):
-    name = gr.GetName() + "_" + mesh_translated.GetName().split("_")[0]
-    mesh_source = smesh.CopyMesh(gr, gr.GetName())
-    mesh_check = smesh.Concatenate([mesh_source.GetMesh(), mesh_translated.GetMesh()], 0, name=name)
-    ll_coincident_nodes = mesh_check.FindCoincidentNodes(tol)
-    coincident_nodes = [item for sublist in ll_coincident_nodes for item in sublist]
-    mesh_check.MakeGroupByIds("coincident_nodes", SMESH.NODE, coincident_nodes)
-    mesh_nodes = mesh_check.GetNodesId()
-    if len(ll_coincident_nodes) != mesh_translated.NbNodes():
-        non_coincident_nodes = list(set(mesh_nodes) - set(coincident_nodes))
-        mesh_check.MakeGroupByIds("non_coincident_nodes", SMESH.NODE, non_coincident_nodes)
-        raise Exception("Projection failed for %s"%name)
-        
-checkProjection(gr_right, left_translated)
-checkProjection(gr_back, front_translated)
-checkProjection(gr_top, bottom_translated)
-
-salome.sg.updateObjBrowser(0)
-
diff --git a/tests/test_periodicity_2D.py b/tests/test_periodicity_2D.py
deleted file mode 100644 (file)
index d5a07bc..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-# -*- coding: iso-8859-1 -*-
-
-import salome
-
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
-
-import math
-
-O = geompy.MakeVertex(0, 0, 0)
-OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
-OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
-OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
-
-Face_1 = geompy.MakeFaceHW(10, 10, 1)
-geomObj_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
-Sketch_1 = geompy.MakeSketcherOnPlane("Sketcher:F -2.5209155082703 -1.4416453838348:TT -1.1105282306671 -2.9872753620148:TT 0.76354801654816 -2.3303825855255:TT 1.9614112377167 -3.0838770866394:TT 3.8354876041412 -1.2677619457245:TT 4.2218952178955 0.644955098629:TT 3.2751967906952 2.5576722621918:TT 0.58966463804245 3.5430111885071:TT -3.7380990982056 3.2338852882385:TT -4.433632850647 0.85747921466827:WW", Face_1 )
-vertices = geompy.ExtractShapes(Sketch_1, geompy.ShapeType["VERTEX"], True)
-Curve_1 = geompy.MakeInterpol(vertices, True, True)
-
-part = geompy.MakePartition([Face_1], [Curve_1], Limit=geompy.ShapeType["FACE"])
-geompy.addToStudy(part, "part")
-
-Vx = geompy.MakeVectorDXDYDZ(1, 0, 0)
-Vy = geompy.MakeVectorDXDYDZ(0, 1, 0)
-Vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
-
-p1 = geompy.MakeVertex(-5, -5, 0)
-p2 = geompy.MakeVertex(5, 5, 0)
-left_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p1, GEOM.ST_ON)
-left = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
-geompy.UnionList(left, left_edges)
-geompy.addToStudyInFather(part, left, "left")
-
-right_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p2, GEOM.ST_ON)
-right = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
-geompy.UnionList(right, right_edges)
-geompy.addToStudyInFather(part, right, "right")
-
-bottom_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p1, GEOM.ST_ON)
-bottom = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
-geompy.UnionList(bottom, bottom_edges)
-geompy.addToStudyInFather(part, bottom, "bottom")
-
-top_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p2, GEOM.ST_ON)
-top = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
-geompy.UnionList(top, top_edges)
-geompy.addToStudyInFather(part, top, "top")
-
-
-# Mesh
-# ====
-
-import SMESH
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
-
-from salome.BLSURFPlugin import BLSURFPluginBuilder
-
-Mesh = smesh.Mesh(part, "Mesh")
-
-algo2d = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf)
-algo2d.SetVerbosity(10)
-#algo2d.SetTopology(smesh.PreCAD)
-algo2d.SetGeometricMesh( 1 )
-algo2d.SetAngleMesh( 4 )
-algo2d.SetPhySize( 8 )
-#algo2d.SetGradation(1.05)
-algo2d.SetOptionValue( 'periodic_tolerance', '1e-2' )
-# Deactivate PreCAD
-algo2d.SetTopology(BLSURFPluginBuilder.FromCAD)
-
-# Periodicity
-
-def proj_x(shape1):
-    shape2 = geompy.MakeTranslation(shape1, 10, 0., 0)
-    return shape2
-    
-def proj_y(shape1):
-    shape2 = geompy.MakeTranslation(shape1, 0, 10., 0)
-    return shape2
-
-algo2d.AddAdvancedEdgesPeriodicity(left, right, proj_x)
-algo2d.AddAdvancedEdgesPeriodicity(bottom, top, proj_y)
-
-Mesh.Compute()
-
-gr_left = Mesh.Group(left)
-gr_right = Mesh.Group(right)
-gr_bottom = Mesh.Group(bottom)
-gr_top = Mesh.Group(top)
-
-Mesh.Compute()
-
-left_translated = Mesh.TranslateObjectMakeMesh( gr_left, SMESH.DirStruct( SMESH.PointStruct ( 10, 0, 0 )), 0, 'left_translated' )
-bottom_translated = Mesh.TranslateObjectMakeMesh( gr_bottom, SMESH.DirStruct( SMESH.PointStruct ( 0, 10, 0 )), 0, 'bottom_translated' )
-
-def checkProjection(gr, mesh_translated, tol=1e-7):
-    name = gr.GetName() + "_" + mesh_translated.GetName().split("_")[0]
-    mesh_source = smesh.CopyMesh(gr, gr.GetName())
-    mesh_check = smesh.Concatenate([mesh_source.GetMesh(), mesh_translated.GetMesh()], 0, name=name)
-    ll_coincident_nodes = mesh_check.FindCoincidentNodes(tol)
-    coincident_nodes = [item for sublist in ll_coincident_nodes for item in sublist]
-    mesh_check.MakeGroupByIds("coincident_nodes", SMESH.NODE, coincident_nodes)
-    mesh_nodes = mesh_check.GetNodesId()
-    if len(ll_coincident_nodes) != mesh_translated.NbNodes():
-        non_coincident_nodes = list(set(mesh_nodes) - set(coincident_nodes))
-        mesh_check.MakeGroupByIds("non_coincident_nodes", SMESH.NODE, non_coincident_nodes)
-        raise Exception("Projection failed for %s"%name)
-        
-checkProjection(gr_right, left_translated)
-checkProjection(gr_top, bottom_translated)
-
-if salome.sg.hasDesktop():
-  salome.sg.updateObjBrowser(1)
diff --git a/tests/test_periodicity_reflexion.py b/tests/test_periodicity_reflexion.py
deleted file mode 100644 (file)
index 91b79b5..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-# -*- coding: utf-8 -*-
-
-import salome
-
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
-
-import math
-
-simple = False
-
-r = 10
-dist = 10
-
-p1 = geompy.MakeVertex(0., 0., 0.)
-p2 = geompy.MakeVertex(100., 100., 100.)
-box = geompy.MakeBoxTwoPnt(p1, p2)
-geompy.addToStudy(box, "box")
-
-p3 = geompy.MakeVertex(25., 5., 25.)
-sphere1 = geompy.MakeSpherePntR(p3, 15.)
-geompy.addToStudy(sphere1, "sphere1")
-
-Vx = geompy.MakeVectorDXDYDZ(1, 0, 0)
-Vy = geompy.MakeVectorDXDYDZ(0, 1, 0)
-Vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
-
-p4 = geompy.MakeVertex(100., 0., 0.)
-axe = geompy.MakePrismVecH(p4, Vz, 1)
-geompy.addToStudy(axe, "axe")
-
-sphere1_rota = geompy.MakeRotation(sphere1, axe, -math.pi/2.)
-geompy.addToStudy(sphere1_rota, "sphere1_rota")
-
-part = geompy.MakePartition([box], [sphere1, sphere1_rota])
-geompy.addToStudy(part, "part")
-
-left_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vy, GEOM.ST_ON)
-left = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(left, left_faces)
-geompy.addToStudyInFather(part, left, "left")
-
-right_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vy, p2, GEOM.ST_ON)
-right = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(right, right_faces)
-geompy.addToStudyInFather(part, right, "right")
-
-back_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vx, GEOM.ST_ON)
-back = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(back, back_faces)
-geompy.addToStudyInFather(part, back, "back")
-
-front_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vx, p2, GEOM.ST_ON)
-front = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(front, front_faces)
-geompy.addToStudyInFather(part, front, "front")
-
-bottom_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vz, GEOM.ST_ON)
-bottom = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(bottom, bottom_faces)
-geompy.addToStudyInFather(part, bottom, "bottom")
-
-top_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vz, p2, GEOM.ST_ON)
-top = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(top, top_faces)
-geompy.addToStudyInFather(part, top, "top")
-
-sources = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
-geompy.UnionList(sources, left_faces)
-geompy.UnionList(sources, back_faces)
-geompy.UnionList(sources, top_faces)
-geompy.addToStudyInFather(part, sources, "sources")
-
-
-# Mesh
-# ====
-
-import SMESH
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
-
-from salome.BLSURFPlugin import BLSURFPluginBuilder
-
-Mesh = smesh.Mesh(part, "Mesh")
-
-algo2d = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf)
-algo2d.SetGeometricMesh( 1 )
-algo2d.SetAngleMesh( 4 )
-algo2d.SetPhySize( 8 )
-algo2d.SetOptionValue( 'periodic_tolerance', '1e-2' )
-# Deactivate PreCAD
-algo2d.SetTopology(BLSURFPluginBuilder.FromCAD)
-
-def rota_z(shape1):
-    shape2 = geompy.MakeRotation(shape1, axe, -math.pi/2)
-    return shape2
-
-algo2d.AddAdvancedFacesPeriodicity(left, front, rota_z)
-
-gr_left = Mesh.Group(left)
-gr_right = Mesh.Group(right)
-gr_front = Mesh.Group(front)
-gr_back = Mesh.Group(back)
-gr_bottom = Mesh.Group(bottom)
-gr_top = Mesh.Group(top)
-
-Mesh.Compute()
-
-left_rotated = Mesh.RotateObjectMakeMesh( gr_left, axe, -math.pi/2, NewMeshName='left_rotated' )
-
-def checkProjection(gr, mesh_translated, tol=1e-7):
-    name = gr.GetName() + "_" + mesh_translated.GetName().split("_")[0]
-    mesh_source = smesh.CopyMesh(gr, gr.GetName())
-    mesh_check = smesh.Concatenate([mesh_source.GetMesh(), mesh_translated.GetMesh()], 0, name=name)
-    ll_coincident_nodes = mesh_check.FindCoincidentNodes(tol)
-    coincident_nodes = [item for sublist in ll_coincident_nodes for item in sublist]
-    mesh_check.MakeGroupByIds("coincident_nodes", SMESH.NODE, coincident_nodes)
-    mesh_nodes = mesh_check.GetNodesId()
-    if len(ll_coincident_nodes) != mesh_translated.NbNodes():
-        non_coincident_nodes = list(set(mesh_nodes) - set(coincident_nodes))
-        mesh_check.MakeGroupByIds("non_coincident_nodes", SMESH.NODE, non_coincident_nodes)
-        raise Exception("Projection failed for %s"%name)
-        
-checkProjection(gr_front, left_rotated)
-
-salome.sg.updateObjBrowser(0)
-
diff --git a/tests/test_periodicity_reflexion_2D.py b/tests/test_periodicity_reflexion_2D.py
deleted file mode 100644 (file)
index 7f9f639..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-# -*- coding: iso-8859-1 -*-
-
-import salome
-
-import GEOM
-from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
-
-import math
-
-O = geompy.MakeVertex(0, 0, 0)
-OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
-OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
-OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
-
-Face_1 = geompy.MakeFaceHW(10, 10, 1)
-geomObj_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
-Sketch_1 = geompy.MakeSketcherOnPlane("Sketcher:F -2.5209155082703 -1.4416453838348:TT -1.1105282306671 -2.9872753620148:TT 0.76354801654816 -2.3303825855255:TT 1.9614112377167 -3.0838770866394:TT 3.8354876041412 -1.2677619457245:TT 4.2218952178955 0.644955098629:TT 3.2751967906952 2.5576722621918:TT 0.58966463804245 3.5430111885071:TT -3.7380990982056 3.2338852882385:TT -4.433632850647 0.85747921466827:WW", Face_1 )
-vertices = geompy.ExtractShapes(Sketch_1, geompy.ShapeType["VERTEX"], True)
-Curve_1 = geompy.MakeInterpol(vertices, True, True)
-
-part = geompy.MakePartition([Face_1], [Curve_1], Limit=geompy.ShapeType["FACE"])
-geompy.addToStudy(part, "part")
-
-Vx = geompy.MakeVectorDXDYDZ(1, 0, 0)
-Vy = geompy.MakeVectorDXDYDZ(0, 1, 0)
-Vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
-
-p1 = geompy.MakeVertex(-5, -5, 0)
-p2 = geompy.MakeVertex(5, 5, 0)
-left_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p1, GEOM.ST_ON)
-left = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
-geompy.UnionList(left, left_edges)
-geompy.addToStudyInFather(part, left, "left")
-
-right_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p2, GEOM.ST_ON)
-right = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
-geompy.UnionList(right, right_edges)
-geompy.addToStudyInFather(part, right, "right")
-
-bottom_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p1, GEOM.ST_ON)
-bottom = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
-geompy.UnionList(bottom, bottom_edges)
-geompy.addToStudyInFather(part, bottom, "bottom")
-
-top_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p2, GEOM.ST_ON)
-top = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
-geompy.UnionList(top, top_edges)
-geompy.addToStudyInFather(part, top, "top")
-
-
-# Mesh
-# ====
-
-import SMESH
-from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
-
-from salome.BLSURFPlugin import BLSURFPluginBuilder
-
-Mesh = smesh.Mesh(part, "Mesh")
-
-algo2d = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf)
-algo2d.SetVerbosity(1)
-#algo2d.SetTopology(smesh.PreCAD)
-algo2d.SetGeometricMesh( 1 )
-algo2d.SetAngleMesh( 4 )
-algo2d.SetPhySize( 8 )
-#algo2d.SetGradation(1.05)
-algo2d.SetOptionValue( 'periodic_tolerance', '1e-2' )
-# Deactivate PreCAD
-algo2d.SetTopology(BLSURFPluginBuilder.FromCAD)
-
-# Periodicity
-
-p_axe = geompy.MakeVertex(5, -5, 0)
-axe = geompy.MakePrismVecH(p_axe, Vz, 1)
-def rota_z(shape1):
-    shape2 = geompy.MakeRotation(shape1, axe, -math.pi/2)
-    return shape2
-
-algo2d.AddAdvancedEdgesPeriodicity(bottom, right, rota_z)
-
-Mesh.Compute()
-
-gr_left = Mesh.Group(left)
-gr_right = Mesh.Group(right)
-gr_bottom = Mesh.Group(bottom)
-gr_top = Mesh.Group(top)
-
-Mesh.Compute()
-
-bottom_rotated = Mesh.RotateObjectMakeMesh( gr_bottom, axe, -math.pi/2, NewMeshName='bottom_rotated' )
-
-def checkProjection(gr, mesh_translated, tol=1e-7):
-    name = gr.GetName() + "_" + mesh_translated.GetName().split("_")[0]
-    mesh_source = smesh.CopyMesh(gr, gr.GetName())
-    mesh_check = smesh.Concatenate([mesh_source.GetMesh(), mesh_translated.GetMesh()], 0, name=name)
-    ll_coincident_nodes = mesh_check.FindCoincidentNodes(tol)
-    coincident_nodes = [item for sublist in ll_coincident_nodes for item in sublist]
-    mesh_check.MakeGroupByIds("coincident_nodes", SMESH.NODE, coincident_nodes)
-    mesh_nodes = mesh_check.GetNodesId()
-    if len(ll_coincident_nodes) != mesh_translated.NbNodes():
-        non_coincident_nodes = list(set(mesh_nodes) - set(coincident_nodes))
-        mesh_check.MakeGroupByIds("non_coincident_nodes", SMESH.NODE, non_coincident_nodes)
-        raise Exception("Projection failed for %s"%name)
-        
-checkProjection(gr_right, bottom_rotated)
-
-if salome.sg.hasDesktop():
-  salome.sg.updateObjBrowser(1)
index c4e991b9ae9ee9e8478a2b081dd804f440ac5317..f492dba1e3bb0a29a13d5517f2451b9cfb78531e 100644 (file)
@@ -59,7 +59,9 @@ for p in vertices:
     id_node = Mesh_1.FindNodeClosestTo(x, y, z)
     nodes.append(id_node)
 
-nodes = set(nodes)
+nodes = list(set(nodes))
+
+Mesh_1.MakeGroupByIds("nodes", SMESH.NODE, nodes)
 
 assert(len(nodes) == 1)
 
index b23102ce07c349885ee86a249980cb2b72d761ff..592ce3fce1367e5ec9e8288e414204f2a5294076 100644 (file)
@@ -51,15 +51,18 @@ BLSURF_Parameters.SetPhySize( 5 )
 Mesh_1.Compute()
 
 # Check that vertices are not merged by preCAD preprocessing
+# when no preprocessing option has been explicitely called
 nodes = []
 for p in vertices:
     x, y, z = geompy.PointCoordinates(p)
     id_node = Mesh_1.FindNodeClosestTo(x, y, z)
     nodes.append(id_node)
 
-nodes = set(nodes)
+nodes = list(set(nodes))
 
-assert(len(nodes) == 2)
+Mesh_1.MakeGroupByIds("nodes", SMESH.NODE, nodes)
+
+assert len(nodes) == 3, "We should have 3 nodes. We got %i. => The preprocessing has done something, but we did not ask him to."%len(nodes)
 
 if salome.sg.hasDesktop():
   salome.sg.updateObjBrowser(1)
index 730f38216a717e1a3b4635a87e5279d740612aff..ced3cb584c83f3e1eaa33ed2d2940de0e7217536 100644 (file)
@@ -78,14 +78,11 @@ gr_mesh_box = Mesh_1.Group(gr_box_faces)
 gr_mesh_spheres = Mesh_1.Group(gr_spheres_faces)
 
 # Check the minimal area of the box faces to check the proximity
-box_ids = gr_mesh_box.GetIDs()
-box_areas = [Mesh_1.GetArea(i) for i in box_ids]
-
-min_area = min(box_areas)
+min_area, max_area = Mesh_1.GetMinMax(SMESH.FT_Area, gr_mesh_box)
 
 print "min_area: ", min_area
 
-if min_area > 1:
+if min_area > 1.5:
     raise Exception("Wrong minimal area on box. Proximity has not worked.")
 
 if salome.sg.hasDesktop():
index b7fac3cee86f89feeef5402b0b03742ca6230f12..965e2018feaae0627990a5470eadf1d20e7aaf39 100644 (file)
@@ -8,15 +8,12 @@ geompy = geomBuilder.New(salome.myStudy)
 
 import math
 
-area_tolerance = 1e-3
-nb_faces_tolerance = 10
+area_tolerance = 1e-2
+nb_faces_tolerance = 20
 
 ## Return the min and max areas of a mesh
 def getMinMaxArea(mesh):
-  faces = mesh.GetElementsByType(SMESH.FACE)
-  areas = [mesh.GetArea(face) for face in faces]
-  mini = min(areas)
-  maxi = max(areas)
+  mini, maxi = mesh.GetMinMax(SMESH.FT_Area)
   return mini, maxi
 
 O = geompy.MakeVertex(0, 0, 0)
@@ -105,14 +102,14 @@ maxi_1_ref = 0.530
 if abs(mini_1-mini_1_ref) > area_tolerance:
   raise Exception("Min area of Mesh_1 incorrect")
 
-if abs(maxi_1-maxi_1_ref) > area_tolerance:
+if maxi_1 > maxi_1_ref:
   raise Exception("Max area of Mesh_1 incorrect")
 
 # Check the number of faces of Mesh_1
 nb_faces_1 = Mesh_1.NbFaces()
 nb_faces_1_ref = 1208
 
-if abs(nb_faces_1-nb_faces_1_ref) > nb_faces_tolerance:
+if nb_faces_1 < nb_faces_1_ref:
   raise Exception("Number of faces of Mesh_1 incorrect")