Salome HOME
0020128: EDF SMESH 926 : Quadratic conversion of BLSURF mesh RELIQUAT_5x_30102009 V5_1_3rc2 V5_1_3rc3
authoreap <eap@opencascade.com>
Fri, 30 Oct 2009 11:27:27 +0000 (11:27 +0000)
committereap <eap@opencascade.com>
Fri, 30 Oct 2009 11:27:27 +0000 (11:27 +0000)
 fix Set_NodeOnEdge()

src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx

index 7b32a33cd127d2cf6b807aba140f93cf2728c969..4f1237c1968b9c708d2f8d8681f96ecd9ee14d4b 100644 (file)
@@ -351,8 +351,8 @@ status_t size_on_vertex(integer vertex_id, real *size, void *user_data);
 double my_u_min=1e6,my_v_min=1e6,my_u_max=-1e6,my_v_max=-1e6;
 
 typedef struct {
-       gp_XY uv;
-       gp_XYZ xyz;
+        gp_XY uv;
+        gp_XYZ xyz;
 } projectionPoint;
 /////////////////////////////////////////////////////////
 projectionPoint getProjectionPoint(const TopoDS_Face& face, const gp_XYZ& point)
@@ -743,7 +743,7 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, blsu
             }
           }
         }
-               
+                
         if (GeomType == TopAbs_FACE){
           HasSizeMapOnFace = true;
           createAttractorOnFace(GeomShape, atIt->second);
@@ -820,7 +820,7 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, blsu
 
 status_t curv_fun(real t, real *uv, real *dt, real *dtt, void *user_data);
 status_t surf_fun(real *uv, real *xyz, real*du, real *dv,
-                 real *duu, real *duv, real *dvv, void *user_data);
+                  real *duu, real *duv, real *dvv, void *user_data);
 status_t message_callback(message_t *msg, void *user_data);
 
 //=============================================================================
@@ -1295,15 +1295,19 @@ void BLSURFPlugin_BLSURF::Set_NodeOnEdge(SMESHDS_Mesh* meshDS, SMDS_MeshNode* no
 
   Standard_Real p0 = 0.0;
   Standard_Real p1 = 1.0;
-  Handle(Geom_Curve) curve = BRep_Tool::Curve(edge, p0, p1);
+  TopLoc_Location loc;
+  Handle(Geom_Curve) curve = BRep_Tool::Curve(edge, loc, p0, p1);
 
-  GeomAPI_ProjectPointOnCurve proj(pnt, curve);
+  if ( !loc.IsIdentity() ) pnt.Transform( loc.Transformation().Inverted() );
+  GeomAPI_ProjectPointOnCurve proj(pnt, curve, p0, p1);
 
-  double pa = (double)proj.Parameter(1);
+  double pa = 0.;
+  if ( proj.NbPoints() > 0 )
+    pa = (double)proj.LowerDistanceParameter();
 
-  GProp_GProps LProps;
-  BRepGProp::LinearProperties(ed, LProps);
-  double lg = (double)LProps.Mass();
+//   GProp_GProps LProps;
+//   BRepGProp::LinearProperties(ed, LProps);
+//   double lg = (double)LProps.Mass();
 
   meshDS->SetNodeOnEdge(node, edge, pa);
 }
@@ -1378,7 +1382,7 @@ status_t curv_fun(real t, real *uv, real *dt, real *dtt, void *user_data)
 }
 
 status_t surf_fun(real *uv, real *xyz, real*du, real *dv,
-                 real *duu, real *duv, real *dvv, void *user_data)
+                  real *duu, real *duv, real *dvv, void *user_data)
 {
   const Geom_Surface* geometry = (const Geom_Surface*) user_data;
 
@@ -1559,8 +1563,8 @@ status_t message_callback(message_t *msg, void *user_data)
  */
 //=============================================================================
 bool BLSURFPlugin_BLSURF::Evaluate(SMESH_Mesh& aMesh,
-                                  const TopoDS_Shape& aShape,
-                                  MapShapeNbElems& aResMap)
+                                   const TopoDS_Shape& aShape,
+                                   MapShapeNbElems& aResMap)
 {
   int    _physicalMesh  = BLSURFPlugin_Hypothesis::GetDefaultPhysicalMesh();
   double _phySize       = BLSURFPlugin_Hypothesis::GetDefaultPhySize();
@@ -1605,11 +1609,11 @@ bool BLSURFPlugin_BLSURF::Evaluate(SMESH_Mesh& aMesh,
       C->D0(f+dp,P2);
       gp_Vec V1(P1,P2);
       for(int j=2; j<=200; j++) {
-       C->D0(f+dp*j,P3);
-       gp_Vec V2(P2,P3);
-       fullAng += fabs(V1.Angle(V2));
-       V1 = V2;
-       P2 = P3;
+        C->D0(f+dp*j,P3);
+        gp_Vec V2(P2,P3);
+        fullAng += fabs(V1.Angle(V2));
+        V1 = V2;
+        P2 = P3;
       }
       nb1d = (int)( fullAng/_angleMeshC + 1 );
     }
@@ -1665,8 +1669,8 @@ bool BLSURFPlugin_BLSURF::Evaluate(SMESH_Mesh& aMesh,
   BRepGProp::VolumeProperties(aShape,G);
   double aVolume = G.Mass();
   double tetrVol = 0.1179*ELen*ELen*ELen;
-  int nbVols = (int)aVolume/tetrVol;
-  int nb1d_in = (int) ( ( nbVols*6 - fullNbSeg ) / 6 );
+  int nbVols  = int(aVolume/tetrVol);
+  int nb1d_in = int(( nbVols*6 - fullNbSeg ) / 6 );
   std::vector<int> aVec(SMDSEntity_Last);
   for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i]=0;
   if( IsQuadratic ) {