Salome HOME
11d86c82f9bfc0064c2bb5ea02d51d964339a334
[modules/smesh.git] / src / SMESH / SMESH_Quadrangle_2D.cxx
1 using namespace std;
2 //=============================================================================
3 // File      : SMESH_Quadrangle_2D.cxx
4 // Created   : sam mai 18 08:11:32 CEST 2002
5 // Author    : Paul RASCLE, EDF
6 // Project   : SALOME
7 // Copyright : EDF 2002
8 // $Header$
9 //=============================================================================
10 using namespace std;
11
12 #include "SMESH_Quadrangle_2D.hxx"
13 #include "SMESH_Gen.hxx"
14 #include "SMESH_Mesh.hxx"
15
16 #include "SMDS_MeshElement.hxx"
17 #include "SMDS_MeshNode.hxx"
18 #include "SMDS_EdgePosition.hxx"
19 #include "SMDS_FacePosition.hxx"
20
21 #include <BRep_Tool.hxx>
22 #include <BRepTools.hxx>
23 #include <BRepTools_WireExplorer.hxx>
24 #include <Geom_Surface.hxx>
25 #include <Geom_Curve.hxx>
26 #include <Geom2d_Curve.hxx>
27 #include <Handle_Geom2d_Curve.hxx>
28 #include <Handle_Geom_Curve.hxx>
29 #include <gp_Pnt2d.hxx>
30 #include <TColStd_ListIteratorOfListOfInteger.hxx>
31
32 #include "utilities.h"
33
34 //=============================================================================
35 /*!
36  *  
37  */
38 //=============================================================================
39
40 SMESH_Quadrangle_2D::SMESH_Quadrangle_2D(int hypId, 
41                                          int studyId, 
42                                          SMESH_Gen* gen)
43   : SMESH_2D_Algo(hypId, studyId, gen)
44 {
45   MESSAGE("SMESH_Quadrangle_2D::SMESH_Quadrangle_2D");
46   _name = "Quadrangle_2D";
47   //  _shapeType = TopAbs_FACE;
48   _shapeType = (1<<TopAbs_FACE);
49 }
50
51 //=============================================================================
52 /*!
53  *  
54  */
55 //=============================================================================
56
57 SMESH_Quadrangle_2D::~SMESH_Quadrangle_2D()
58 {
59   MESSAGE("SMESH_Quadrangle_2D::~SMESH_Quadrangle_2D");
60 }
61
62 //=============================================================================
63 /*!
64  *  
65  */
66 //=============================================================================
67
68 bool SMESH_Quadrangle_2D::CheckHypothesis(SMESH_Mesh& aMesh,
69                                           const TopoDS_Shape& aShape)
70 {
71   //MESSAGE("SMESH_Quadrangle_2D::CheckHypothesis");
72
73   bool isOk = true;
74
75   // nothing to check
76
77   return isOk;
78 }
79
80
81 //=============================================================================
82 /*!
83  *  
84  */
85 //=============================================================================
86
87 bool SMESH_Quadrangle_2D::Compute(SMESH_Mesh& aMesh,
88                                   const TopoDS_Shape& aShape)
89   throw (SALOME_Exception)
90 {
91   //MESSAGE("SMESH_Quadrangle_2D::Compute");
92   const Handle(SMESHDS_Mesh)& meshDS = aMesh.GetMeshDS();
93   SMESH_subMesh* theSubMesh = aMesh.GetSubMesh(aShape);
94
95   FaceQuadStruct* quad = CheckAnd2Dcompute(aMesh, aShape);
96   if (!quad) return false;
97
98   // --- compute 3D values on points, store points & quadrangles
99
100   int nbdown = quad->nbPts[0];
101   int nbright = quad->nbPts[1];
102   int nbVertices = nbdown*nbright;
103   int nbQuad = (nbdown-1)*(nbright-1);
104   //SCRUTE(nbVertices);
105   //SCRUTE(nbQuad);
106
107   //   const TopoDS_Face& FF = TopoDS::Face(aShape);
108   //   bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD);
109   //   TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD));
110   const TopoDS_Face& F = TopoDS::Face(aShape);
111   bool faceIsForward = (F.Orientation() == TopAbs_FORWARD);
112   Handle(Geom_Surface) S = BRep_Tool::Surface(F);
113
114   for (int i=1; i<nbdown-1; i++)
115     for (int j=1; j<nbright-1; j++)    // internal points
116       {
117         int ij = j*nbdown +i;
118         double u = quad->uv_grid[ij].u;
119         double v = quad->uv_grid[ij].v;
120         gp_Pnt P = S->Value(u,v);
121         int nodeId = meshDS->AddNode(P.X(), P.Y(), P.Z());
122         //MESSAGE("point "<< nodeId<<" "<<" "<<P.X()<<" "<<P.Y()<<" "<<P.Z());
123         Handle (SMDS_MeshElement) elt = meshDS->FindNode(nodeId);
124         Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt);
125         meshDS->SetNodeOnFace(node, F);
126         quad->uv_grid[ij].nodeId = nodeId; 
127 //      Handle (SMDS_FacePosition) fpos
128 //        = new SMDS_FacePosition(theSubMesh->GetId(),i,j); // easier than u,v
129 //      node->SetPosition(fpos);
130         Handle (SMDS_FacePosition) fpos
131           = Handle (SMDS_FacePosition)::DownCast(node->GetPosition());
132         fpos->SetUParameter(i);
133         fpos->SetVParameter(j);
134       }
135
136   //   bool isQuadForward = ( faceIsForward == quad->isEdgeForward[0]);
137   for (int i=0; i<nbdown-1; i++)
138     for (int j=0; j<nbright-1; j++)    // faces
139       {
140         int a = quad->uv_grid[   j *nbdown +i  ].nodeId;
141         int b = quad->uv_grid[   j *nbdown +i+1].nodeId;
142         int c = quad->uv_grid[(j+1)*nbdown +i+1].nodeId;
143         int d = quad->uv_grid[(j+1)*nbdown +i  ].nodeId;
144         int faceId;
145         //      if (isQuadForward) faceId = meshDS->AddFace(a,b,c,d);
146         //      else faceId = meshDS->AddFace(a,d,c,b);
147         faceId = meshDS->AddFace(a,b,c,d);
148         Handle (SMDS_MeshElement) elt = meshDS->FindElement(faceId);
149         meshDS->SetMeshElementOnShape(elt, F);
150       }
151
152   QuadDelete(quad);
153   bool isOk = true;
154   return isOk;
155 }
156
157 //=============================================================================
158 /*!
159  *  
160  */
161 //=============================================================================
162
163 FaceQuadStruct*
164 SMESH_Quadrangle_2D::CheckAnd2Dcompute(SMESH_Mesh& aMesh,
165                                        const TopoDS_Shape& aShape)
166   throw (SALOME_Exception)
167 {
168   //MESSAGE("SMESH_Quadrangle_2D::ComputeWithoutStore");
169
170   SMESH_subMesh* theSubMesh = aMesh.GetSubMesh(aShape);
171
172   //   const TopoDS_Face& FF = TopoDS::Face(aShape);
173   //   bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD);
174   //   TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD));
175   const TopoDS_Face& F = TopoDS::Face(aShape);
176   bool faceIsForward = (F.Orientation() == TopAbs_FORWARD);
177
178   // verify 1 wire only, with 4 edges, same number of points on opposite edges
179
180   if (NumberOfWires (F) != 1)
181     {
182       MESSAGE("only 1 wire by face (quadrangles)");
183       return 0;
184       //throw SALOME_Exception(LOCALIZED("only 1 wire by face (quadrangles)"));
185     }
186   //   const TopoDS_Wire WW = BRepTools::OuterWire(F);
187   //   TopoDS_Wire W = TopoDS::Wire(WW.Oriented(TopAbs_FORWARD));
188   const TopoDS_Wire& W = BRepTools::OuterWire(F);
189   BRepTools_WireExplorer wexp(W,F);    
190
191   FaceQuadStruct* quad = new FaceQuadStruct;
192   for (int i=0; i<4; i++) quad->uv_edges[i] = 0;
193   quad->uv_grid = 0;
194
195   int nbEdges = 0;
196   for (wexp.Init(W,F);wexp.More(); wexp.Next())
197     {
198       //       const TopoDS_Edge& EE = wexp.Current();
199       //       TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD));
200       const TopoDS_Edge& E = wexp.Current();
201       int nb = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
202       if (nbEdges < 4)
203         {         
204           quad->edge[nbEdges] = E;
205           quad->nbPts[nbEdges] = nb +2; // internal points + 2 extrema
206         }
207       nbEdges++;
208     }
209
210   if (nbEdges != 4)
211     {
212       MESSAGE("face must have 4 edges /quadrangles");
213       QuadDelete(quad);
214       return 0;
215       //throw SALOME_Exception(LOCALIZED("face must have 4 edges /quadrangles"));
216     }
217
218   if (quad->nbPts[0] != quad->nbPts[2])
219     {
220       MESSAGE("different point number-opposed edge");
221       QuadDelete(quad);
222       return 0;
223       //throw SALOME_Exception(LOCALIZED("different point number-opposed edge"));
224     }
225
226   if (quad->nbPts[1] != quad->nbPts[3])
227     {
228       MESSAGE("different point number-opposed edge");
229       QuadDelete(quad);
230       return 0;
231       //throw SALOME_Exception(LOCALIZED("different point number-opposed edge"));
232     }
233
234   // set normalized grid on unit square in parametric domain
235
236   SetNormalizedGrid(aMesh, F, quad);
237   
238   return quad;
239 }
240
241
242 //=============================================================================
243 /*!
244  *  
245  */
246 //=============================================================================
247
248   void SMESH_Quadrangle_2D::QuadDelete(FaceQuadStruct* quad)
249 {
250   //MESSAGE("SMESH_Quadrangle_2D::QuadDelete");
251   if (quad)
252     {
253       for (int i=0; i<4; i++)
254         {
255           if (quad->uv_edges[i]) delete [] quad->uv_edges[i];
256           quad->edge[i].Nullify();
257         }
258       if (quad->uv_grid) delete [] quad->uv_grid;
259       delete quad;
260    }
261 }
262
263 //=============================================================================
264 /*!
265  *  
266  */
267 //=============================================================================
268
269 void SMESH_Quadrangle_2D::SetNormalizedGrid(SMESH_Mesh& aMesh,
270                                             const TopoDS_Shape& aShape,
271                                             FaceQuadStruct* quad)
272   throw (SALOME_Exception)
273 {
274   // Algorithme décrit dans "Génération automatique de maillages"
275   // P.L. GEORGE, MASSON, Â§ 6.4.1 p. 84-85
276   // traitement dans le domaine paramétrique 2d u,v
277   // transport - projection sur le carré unité
278
279   const TopoDS_Face& F = TopoDS::Face(aShape);
280
281   // 1 --- find orientation of the 4 edges, by test on extrema
282
283   //      max             min                    0     x1     1
284   //     |<----north-2-------^                a3 -------------> a2
285   //     |                   |                   ^1          1^
286   //    west-3            east-1 =right          |            |
287   //     |                   |         ==>       |            |
288   //  y0 |                   | y1                |            |
289   //     |                   |                   |0          0|
290   //     v----south-0-------->                a0 -------------> a1
291   //      min             max                    0     x0     1
292   //             =down
293   //
294
295   Handle (Geom2d_Curve) c2d[4];
296   gp_Pnt2d pf[4];
297   gp_Pnt2d pl[4];
298   for (int i=0; i<4; i++)
299     {
300       c2d[i] = BRep_Tool::CurveOnSurface(quad->edge[i],
301                                          F,
302                                          quad->first[i],
303                                          quad->last[i]);
304       pf[i] = c2d[i]->Value(quad->first[i]);
305       pl[i] = c2d[i]->Value(quad->last[i]);
306       quad->isEdgeForward[i] = false;
307     }
308
309   double eps2d = 1.e-3; // *** utiliser plutot TopExp::CommonVertex, puis
310                         // distances si piece fausse
311   int i=0;
312   if ((pf[1].Distance(pl[0]) < eps2d) || (pl[1].Distance(pl[0]) < eps2d))
313     {
314       quad->isEdgeForward[0] = true;
315     }
316   else
317     {
318       double tmp =quad->first[0];
319       quad->first[0] = quad->last[0];
320       quad->last[0] = tmp;
321       pf[0] = c2d[0]->Value(quad->first[0]);
322       pl[0] = c2d[0]->Value(quad->last[0]);
323     }
324   for (int i=1; i<4; i++)
325     {
326       quad->isEdgeForward[i] = (pf[i].Distance(pl[i-1]) < eps2d);
327       if (! quad->isEdgeForward[i])
328         {
329           double tmp =quad->first[i];
330           quad->first[i] = quad->last[i];
331           quad->last[i] = tmp;
332           pf[i] = c2d[i]->Value(quad->first[i]);
333           pl[i] = c2d[i]->Value(quad->last[i]);
334           //SCRUTE(pf[i].Distance(pl[i-1]));
335           ASSERT(pf[i].Distance(pl[i-1]) < eps2d);
336         }
337     }
338   //SCRUTE(pf[0].Distance(pl[3]));
339   ASSERT(pf[0].Distance(pl[3]) < eps2d);
340
341 //   for (int i=0; i<4; i++)
342 //     {
343 //       SCRUTE(quad->isEdgeForward[i]);
344 //       MESSAGE(" -first "<<i<<" "<<pf[i].X()<<" "<<pf[i].Y());
345 //       MESSAGE(" -last  "<<i<<" "<<pl[i].X()<<" "<<pl[i].Y());
346 //     }
347
348   // 2 --- load 2d edge points (u,v) with orientation and value on unit square
349
350   for (int i=0; i<2; i++)
351     {
352       quad->uv_edges[i] = LoadEdgePoints(aMesh, F,
353                                          quad->edge[i],
354                                          quad->first[i],
355                                          quad->last[i]);
356
357       //                                             quad->isEdgeForward[i]);
358     }
359   for (int i=2; i<4; i++)
360     {
361       quad->uv_edges[i] = LoadEdgePoints(aMesh, F,
362                                          quad->edge[i],
363                                          quad->last[i],
364                                          quad->first[i]);
365
366       //                                             !quad->isEdgeForward[i]);
367     }
368
369   // 3 --- 2D normalized values on unit square [0..1][0..1]
370
371   int nbdown = quad->nbPts[0];
372   int nbright = quad->nbPts[1];
373   quad->uv_grid  = new UVPtStruct[nbright*nbdown];
374
375   UVPtStruct* uv_grid = quad->uv_grid;
376   UVPtStruct* uv_e0   = quad->uv_edges[0];
377   UVPtStruct* uv_e1   = quad->uv_edges[1];
378   UVPtStruct* uv_e2   = quad->uv_edges[2];
379   UVPtStruct* uv_e3   = quad->uv_edges[3];
380   gp_Pnt2d a0 = pf[0];
381   gp_Pnt2d a1 = pf[1];
382   gp_Pnt2d a2 = pf[2];
383   gp_Pnt2d a3 = pf[3];
384
385   // nodes Id on edges
386
387   int j = 0;
388   for (int i=0; i<nbdown; i++)
389     {
390       int ij = j*nbdown +i;
391       uv_grid[ij].nodeId = uv_e0[i].nodeId;
392     }
393   i = nbdown-1;
394   for (int j=0; j<nbright; j++)
395     {
396       int ij = j*nbdown +i;
397       uv_grid[ij].nodeId = uv_e1[j].nodeId;
398     }
399   j = nbright -1;
400   for (int i=0; i<nbdown; i++)
401     {
402       int ij = j*nbdown +i;
403       uv_grid[ij].nodeId = uv_e2[i].nodeId;
404     }
405   i = 0;
406   for (int j=0; j<nbright; j++)
407     {
408       int ij = j*nbdown +i;
409       uv_grid[ij].nodeId = uv_e3[j].nodeId;
410     }
411
412   // normalized 2d values on grid
413
414   for (int i=0; i<nbdown; i++)
415     for (int j=0; j<nbright; j++)
416       {
417         int ij = j*nbdown +i;
418         // --- droite i cste : x = x0 + y(x1-x0)
419         double x0 = uv_e0[i].normParam;              // bas - sud
420         double x1 = uv_e2[i].normParam;              // haut - nord
421         // --- droite j cste : y = y0 + x(y1-y0)
422         double y0 = uv_e3[j].normParam;              // gauche-ouest
423         double y1 = uv_e1[j].normParam;              // droite - est
424         // --- intersection : x=x0+(y0+x(y1-y0))(x1-x0)
425         double x=(x0+y0*(x1-x0))/(1-(y1-y0)*(x1-x0));
426         double y=y0+x*(y1-y0);
427         uv_grid[ij].x = x;
428         uv_grid[ij].y = y;
429         //MESSAGE("-xy-01 "<<x0<<" "<<x1<<" "<<y0<<" "<<y1);
430         //MESSAGE("-xy-norm "<<i<<" "<<j<<" "<<x<<" "<<y);
431       }
432
433   // 4 --- projection on 2d domain (u,v)
434
435   for (int i=0; i<nbdown; i++)
436     for (int j=0; j<nbright; j++)
437       {
438         int ij = j*nbdown +i;
439         double x = uv_grid[ij].x;
440         double y = uv_grid[ij].y;
441         double param_0 = uv_e0[0].param
442           + x*(uv_e0[nbdown-1].param -uv_e0[0].param);     // sud
443         double param_2 = uv_e2[0].param
444           + x*(uv_e2[nbdown-1].param -uv_e2[0].param);     // nord
445         double param_1 = uv_e1[0].param
446           + y*(uv_e1[nbright-1].param -uv_e1[0].param);    // est
447         double param_3 = uv_e3[0].param
448           + y*(uv_e3[nbright-1].param -uv_e3[0].param);    // ouest
449
450         //MESSAGE("params "<<param_0<<" "<<param_1<<" "<<param_2<<" "<<param_3);
451         gp_Pnt2d p0 = c2d[0]->Value(param_0);
452         gp_Pnt2d p1 = c2d[1]->Value(param_1);
453         gp_Pnt2d p2 = c2d[2]->Value(param_2);
454         gp_Pnt2d p3 = c2d[3]->Value(param_3);
455
456         double u = (1-y)*p0.X() + x*p1.X() + y*p2.X() + (1-x)*p3.X();
457         double v = (1-y)*p0.Y() + x*p1.Y() + y*p2.Y() + (1-x)*p3.Y();
458
459         u -= (1-x)*(1-y)*a0.X() + x*(1-y)*a1.X() + x*y*a2.X() + (1-x)*y*a3.X();
460         v -= (1-x)*(1-y)*a0.Y() + x*(1-y)*a1.Y() + x*y*a2.Y() + (1-x)*y*a3.Y();
461
462         uv_grid[ij].u = u;
463         uv_grid[ij].v = v;
464
465         //MESSAGE("-uv- "<<i<<" "<<j<<" "<<uv_grid[ij].u<<" "<<uv_grid[ij].v);
466       }
467 }
468
469 //=============================================================================
470 /*!
471  *  
472  */
473 //=============================================================================
474
475 UVPtStruct* SMESH_Quadrangle_2D::LoadEdgePoints(SMESH_Mesh& aMesh,
476                                                 const TopoDS_Face& F,
477                                                 const TopoDS_Edge& E,
478                                                 double first,
479                                                 double last)
480   //                                            bool isForward)
481 {
482   //MESSAGE("SMESH_Quadrangle_2D::LoadEdgePoints");
483
484   Handle (SMDS_Mesh) meshDS = aMesh.GetMeshDS();
485
486   // --- IDNodes of first and last Vertex
487
488   TopoDS_Vertex VFirst, VLast;
489   TopExp::Vertices(E, VFirst, VLast); // corresponds to f and l
490   
491   ASSERT(!VFirst.IsNull());
492   SMESH_subMesh* firstSubMesh = aMesh.GetSubMesh(VFirst);
493   const TColStd_ListOfInteger& lidf
494     = firstSubMesh->GetSubMeshDS()->GetIDNodes();
495   int idFirst= lidf.First();
496   //SCRUTE(idFirst);
497   
498   ASSERT(!VLast.IsNull());
499   SMESH_subMesh* lastSubMesh = aMesh.GetSubMesh(VLast);
500   const TColStd_ListOfInteger& lidl
501     = lastSubMesh->GetSubMeshDS()->GetIDNodes();
502   int idLast= lidl.First();
503   //SCRUTE(idLast);
504
505   // --- edge internal IDNodes (relies on good order storage, not checked)
506
507   int nbPoints = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
508   //SCRUTE(nbPoints);
509   UVPtStruct * uvslf = new UVPtStruct[nbPoints+2];
510   
511   double f,l;
512   Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E,F,f,l);
513   
514   const TColStd_ListOfInteger& indElt
515     = aMesh.GetSubMesh(E)->GetSubMeshDS()->GetIDNodes();
516   TColStd_ListIteratorOfListOfInteger ite(indElt);
517   //SCRUTE(nbPoints);
518   //SCRUTE(indElt.Extent());
519   ASSERT(nbPoints == indElt.Extent());
520
521   map<double,int> params;
522   for (; ite.More(); ite.Next())
523     {
524       int nodeId = ite.Value();
525       Handle (SMDS_MeshElement) elt = meshDS->FindNode(nodeId);
526       Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt);
527       Handle (SMDS_EdgePosition) epos
528         = Handle (SMDS_EdgePosition)::DownCast(node->GetPosition());
529       double param = epos->GetUParameter();
530       params[param] = nodeId;
531     }
532
533   bool isForward = (((l-f)*(last-first)) > 0);
534   double paramin = 0;
535   double paramax = 0;
536   if (isForward)
537     {
538       paramin = f;
539       paramax = l;
540       gp_Pnt2d p = C2d->Value(f);           // first point = Vertex Forward
541       uvslf [0].x = p.X();
542       uvslf [0].y = p.Y();
543       uvslf [0].param = f;
544       uvslf [0].nodeId = idFirst;
545       //MESSAGE("__ f "<<f<<" "<<uvslf[0].x <<" "<<uvslf[0].y);
546       map<double,int>::iterator itp = params.begin();
547       for (int i = 1; i <= nbPoints; i++)   // nbPoints internal
548         {
549           double param = (*itp).first;
550           int nodeId = (*itp).second;
551           gp_Pnt2d p = C2d->Value(param);
552           uvslf [i].x = p.X();
553           uvslf [i].y = p.Y();
554           uvslf[i].param = param;
555           uvslf[i].nodeId = nodeId;
556           //MESSAGE("__ "<<i<<" "<<param<<" "<<uvslf[i].x <<" "<<uvslf[i].y);
557           itp++;
558         }
559       p = C2d->Value(l);                    // last point = Vertex Reversed
560       uvslf [nbPoints+1].x = p.X();
561       uvslf [nbPoints+1].y = p.Y();
562       uvslf [nbPoints+1].param = l;
563       uvslf [nbPoints+1].nodeId = idLast;
564       //MESSAGE("__ l "<<l<<" "<<uvslf[nbPoints+1].x <<" "<<uvslf[nbPoints+1].y);
565     }
566   else 
567     {
568       paramin = l;
569       paramax = f;
570       gp_Pnt2d p = C2d->Value(l);           // first point = Vertex Reversed
571       uvslf [0].x = p.X();
572       uvslf [0].y = p.Y();
573       uvslf [0].param = l;
574       uvslf [0].nodeId = idLast;
575       //MESSAGE("__ l "<<l<<" "<<uvslf[0].x <<" "<<uvslf[0].y);
576       map<double,int>::reverse_iterator itp = params.rbegin();
577       for (int j = nbPoints; j >= 1; j--)     // nbPoints internal
578         {
579           double param = (*itp).first;
580           int nodeId = (*itp).second;
581           int i = nbPoints +1 -j;
582           gp_Pnt2d p = C2d->Value(param);
583           uvslf [i].x = p.X();
584           uvslf [i].y = p.Y();
585           uvslf[i].param = param;
586           uvslf[i].nodeId = nodeId;
587           //MESSAGE("__ "<<i<<" "<<param<<" "<<uvslf[i].x <<" "<<uvslf[i].y);
588           itp++;
589         }
590       p = C2d->Value(f);                    // last point = Vertex Forward
591       uvslf [nbPoints+1].x = p.X();
592       uvslf [nbPoints+1].y = p.Y();
593       uvslf [nbPoints+1].param = f;
594       uvslf [nbPoints+1].nodeId = idFirst;
595       //MESSAGE("__ f "<<f<<" "<<uvslf[nbPoints+1].x <<" "<<uvslf[nbPoints+1].y);
596     }
597
598   ASSERT(paramin != paramax);
599   for (int i = 0; i< nbPoints+2; i++)
600     {
601       uvslf[i].normParam = (uvslf[i].param -paramin)/(paramax -paramin);
602       //SCRUTE(uvslf[i].normParam);
603     }
604
605   return uvslf;
606 }
607
608 //=============================================================================
609 /*!
610  *  
611  */
612 //=============================================================================
613
614 ostream & SMESH_Quadrangle_2D::SaveTo(ostream & save)
615 {
616   return save << this;
617 }
618
619 //=============================================================================
620 /*!
621  *  
622  */
623 //=============================================================================
624
625 istream & SMESH_Quadrangle_2D::LoadFrom(istream & load)
626 {
627   return load >> (*this);
628 }
629
630 //=============================================================================
631 /*!
632  *  
633  */
634 //=============================================================================
635
636 ostream & operator << (ostream & save, SMESH_Quadrangle_2D & hyp)
637 {
638   return save;
639 }
640
641 //=============================================================================
642 /*!
643  *  
644  */
645 //=============================================================================
646
647 istream & operator >> (istream & load, SMESH_Quadrangle_2D & hyp)
648 {
649   return load;
650 }