Salome HOME
Issue 0020436: [ CEA 348 ] Update plugin BLSURF (2.7 -> 2.8)
authorvsr <vsr@opencascade.com>
Fri, 24 Jul 2009 05:36:59 +0000 (05:36 +0000)
committervsr <vsr@opencascade.com>
Fri, 24 Jul 2009 05:36:59 +0000 (05:36 +0000)
src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx
src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx

index a6036a34ac015222790dd8b1884235f8a8ad4510..ca2fc05d6cb0c31a9f4fc752e2cb2d1e81c08741 100644 (file)
 #include <SMESH_Mesh.hxx>
 #include <SMESH_ControlsDef.hxx>
 
-#include <SMESHDS_Mesh.hxx>
-#include <SMDS_MeshElement.hxx>
-#include <SMDS_MeshNode.hxx>
-
 #include <utilities.h>
 
 #include <limits>
 #include <BRep_Tool.hxx>
 #include <TopExp.hxx>
 #include <TopExp_Explorer.hxx>
-#include <TopoDS.hxx>
 #include <NCollection_Map.hxx>
 #include <Standard_ErrorHandler.hxx>
 
-extern "C"{
-#include <distene/api.h>
-}
-
 #include <Geom_Surface.hxx>
 #include <Handle_Geom_Surface.hxx>
 #include <Geom2d_Curve.hxx>
 #include <Handle_Geom2d_Curve.hxx>
 #include <Geom_Curve.hxx>
 #include <Handle_Geom_Curve.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Wire.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Shape.hxx>
 #include <gp_Pnt2d.hxx>
 #include <TopTools_IndexedMapOfShape.hxx>
 #include <BRepTools.hxx>
@@ -570,6 +556,7 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, blsu
   }
   blsurf_set_param(bls, "hphydef",           to_string(_phySize).c_str());
   blsurf_set_param(bls, "hgeo_flag",         to_string(_geometricMesh).c_str());
+  blsurf_set_param(bls, "relax_size",        _decimesh ? "0": to_string(_geometricMesh).c_str());
   blsurf_set_param(bls, "angle_meshs",       to_string(_angleMeshS).c_str());
   blsurf_set_param(bls, "angle_meshc",       to_string(_angleMeshC).c_str());
   blsurf_set_param(bls, "gradation",         to_string(_gradation).c_str());
@@ -835,11 +822,11 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape)
     mesh_get_edge_tag(msh, it, &tag);
 
     if (tags[vtx[0]]) {
-      meshDS->SetNodeOnEdge(nodes[vtx[0]], TopoDS::Edge(emap(tag)));
+      Set_NodeOnEdge(meshDS, nodes[vtx[0]], emap(tag));
       tags[vtx[0]] = false;
     };
     if (tags[vtx[1]]) {
-      meshDS->SetNodeOnEdge(nodes[vtx[1]], TopoDS::Edge(emap(tag)));
+      Set_NodeOnEdge(meshDS, nodes[vtx[1]], emap(tag));
       tags[vtx[1]] = false;
     };
     meshDS->SetMeshElementOnShape(edg, TopoDS::Edge(emap(tag)));
@@ -909,6 +896,32 @@ bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape)
   return true;
 }
 
+//=============================================================================
+/*!
+ *  SetNodeOnEdge
+ */
+//=============================================================================
+
+void BLSURFPlugin_BLSURF::Set_NodeOnEdge(SMESHDS_Mesh* meshDS, SMDS_MeshNode* node, const TopoDS_Shape& ed) {
+  const TopoDS_Edge edge = TopoDS::Edge(ed);
+
+  gp_Pnt pnt(node->X(), node->Y(), node->Z());
+
+  Standard_Real p0 = 0.0;
+  Standard_Real p1 = 1.0;
+  Handle(Geom_Curve) curve = BRep_Tool::Curve(edge, p0, p1);
+
+  GeomAPI_ProjectPointOnCurve proj(pnt, curve);
+
+  double pa = (double)proj.Parameter(1);
+
+  GProp_GProps LProps;
+  BRepGProp::LinearProperties(ed, LProps);
+  double lg = (double)LProps.Mass();
+
+  meshDS->SetNodeOnEdge(node, edge, pa);
+}
+
 //=============================================================================
 /*!
  *
index 5c9bc67f2a951a33ff4ef43fb7d8601bf0019e19..bb81452ac8f9ae78ac9027b77186f8ed5dabb88f 100644 (file)
 #ifndef _BLSURFPlugin_BLSURF_HXX_
 #define _BLSURFPlugin_BLSURF_HXX_
 
+#include <TopoDS.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Wire.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Shape.hxx>
+
 #include <Python.h>
 #include "SMESH_2D_Algo.hxx"
 #include "SMESH_Mesh.hxx"
+#include <SMESHDS_Mesh.hxx>
+#include <SMDS_MeshElement.hxx>
+#include <SMDS_MeshNode.hxx>
 #include <SMESH_Gen_i.hxx>
 #include <SALOMEconfig.h>
 #include CORBA_CLIENT_HEADER(SALOMEDS)
 #include CORBA_CLIENT_HEADER(GEOM_Gen)
 #include "Utils_SALOME_Exception.hxx"
+
 extern "C"{
+#include "distene/blsurf.h"
 #include "distene/api.h"
 }
 
 class BLSURFPlugin_Hypothesis;
-class TopoDS_Shape;
 
 class BLSURFPlugin_BLSURF: public SMESH_2D_Algo {
   public:
@@ -68,6 +79,9 @@ class BLSURFPlugin_BLSURF: public SMESH_2D_Algo {
   protected:
     const BLSURFPlugin_Hypothesis* _hypothesis;
 
+  private:
+    void Set_NodeOnEdge(SMESHDS_Mesh* meshDS, SMDS_MeshNode* node, const TopoDS_Shape& ed);
+
   private:
       PyObject *          main_mod;
       PyObject *          main_dict;