From 5f9926ceaf6cc344dd5d5da4eb617bfb7556492d Mon Sep 17 00:00:00 2001 From: nge Date: Tue, 21 Jul 2009 15:14:30 +0000 Subject: [PATCH] issue 0020436 : Integration Request of FKL - modification because of update from BLSurf 2.7 to BLSurf 2.8 - new functionality (see attached pictures) - calculate the parameter value of nodes associated on an edges --- src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx | 35 ++++++++++++++++++++---- src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx | 8 ++++++ 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx index 77b603b..0e78127 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx @@ -33,10 +33,6 @@ #include #include -#include -#include -#include - #include #include @@ -591,6 +587,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()); @@ -856,11 +853,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))); @@ -930,6 +927,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); +} + //============================================================================= /*! * diff --git a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx index 5c9bc67..6ee99a3 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx +++ b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx @@ -29,12 +29,17 @@ #include #include "SMESH_2D_Algo.hxx" #include "SMESH_Mesh.hxx" +#include +#include +#include #include #include #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" } @@ -68,6 +73,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; -- 2.39.2