1 // Created on: 1995-10-19
2 // Created by: Andre LIEUTIER
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <math_Gauss.hxx>
19 #include <math_Matrix.hxx>
20 #include <math_Vector.hxx>
21 #include <Plate_FreeGtoCConstraint.hxx>
22 #include <Plate_GlobalTranslationConstraint.hxx>
23 #include <Plate_GtoCConstraint.hxx>
24 #include <Plate_LinearScalarConstraint.hxx>
25 #include <Plate_LinearXYZConstraint.hxx>
26 #include <Plate_LineConstraint.hxx>
27 #include <Plate_PinpointConstraint.hxx>
28 #include <Plate_PlaneConstraint.hxx>
29 #include <Plate_Plate.hxx>
30 #include <Plate_SampledCurveConstraint.hxx>
32 //=======================================================================
33 //function : Plate_Plate
35 //=======================================================================
36 Plate_Plate::Plate_Plate()
37 : order(0), n_el(0), n_dim(0),
38 solution(0),points(0),deru(0),derv(0),
39 OK(Standard_False),maxConstraintOrder(0),
46 PolynomialPartOnly = Standard_False;
47 memset (ddu, 0, sizeof (ddu));
48 memset (ddv, 0, sizeof (ddv));
51 //=======================================================================
52 //function : Plate_Plate
54 //=======================================================================
56 Plate_Plate::Plate_Plate(const Plate_Plate& Ref)
57 : order(Ref.order),n_el(Ref.n_el),n_dim(Ref.n_dim),
58 solution(0),points(0),deru(0),derv(0),
68 if (n_dim >0 && Ref.solution != 0) {
69 solution = new gp_XYZ[n_dim];
70 for(i=0; i<n_dim ;i++) {
71 Solution(i) = Ref.Solution(i);
76 if (Ref.points != 0) {
77 points = new gp_XY[n_el];
78 for(i=0; i<n_el;i++) {
79 Points(i) = Ref.Points(i);
84 deru = new Standard_Integer[n_el] ;
85 for (i = 0 ; i < n_el ; i++) {
86 Deru(i) = Ref.Deru(i);
91 derv = new Standard_Integer[n_el] ;
92 for (i = 0 ; i < n_el ; i++) {
93 Derv(i) = Ref.Derv(i);
99 myConstraints = Ref.myConstraints;
100 myLXYZConstraints = Ref.myLXYZConstraints;
101 myLScalarConstraints = Ref.myLScalarConstraints;
102 maxConstraintOrder = Ref.maxConstraintOrder;
103 PolynomialPartOnly = Ref.PolynomialPartOnly;
104 for (i=0; i<10;i++) {
109 //=======================================================================
112 //=======================================================================
113 Plate_Plate& Plate_Plate::Copy(const Plate_Plate& Ref)
122 if (n_dim >0 && Ref.solution != 0) {
123 solution = new gp_XYZ[n_dim];
124 for(i=0; i<n_dim ;i++) {
125 Solution(i) = Ref.Solution(i);
130 if (Ref.points != 0) {
131 points = new gp_XY[n_el];
132 for(i=0; i<n_el;i++) {
133 Points(i) = Ref.Points(i);
138 deru = new Standard_Integer[n_el] ;
139 for (i = 0 ; i < n_el ; i++) {
140 Deru(i) = Ref.Deru(i);
145 derv = new Standard_Integer[n_el] ;
146 for (i = 0 ; i < n_el ; i++) {
147 Derv(i) = Ref.Derv(i);
153 myConstraints = Ref.myConstraints;
154 myLXYZConstraints = Ref.myLXYZConstraints;
155 myLScalarConstraints = Ref.myLScalarConstraints;
156 maxConstraintOrder = Ref.maxConstraintOrder;
157 PolynomialPartOnly = Ref.PolynomialPartOnly;
159 for (i=0; i<10;i++) {
165 //=======================================================================
168 //=======================================================================
170 void Plate_Plate::Load(const Plate_PinpointConstraint& PConst)
174 myConstraints.Append(PConst);
175 Standard_Integer OrdreConst = PConst.Idu() + PConst.Idv();
176 if(maxConstraintOrder<OrdreConst) maxConstraintOrder = OrdreConst;
179 void Plate_Plate::Load(const Plate_LinearXYZConstraint& LXYZConst)
182 n_el += LXYZConst.Coeff().RowLength();
184 myLXYZConstraints.Append(LXYZConst);
185 for(Standard_Integer j=1;j <= LXYZConst.GetPPC().Length() ; j++)
187 Standard_Integer OrdreConst = LXYZConst.GetPPC()(j).Idu() + LXYZConst.GetPPC()(j).Idv();
188 if(maxConstraintOrder<OrdreConst) maxConstraintOrder = OrdreConst;
192 void Plate_Plate::Load(const Plate_LinearScalarConstraint& LScalarConst)
195 n_el += LScalarConst.Coeff().RowLength();
196 myLScalarConstraints.Append(LScalarConst);
197 for(Standard_Integer j=1;j <= LScalarConst.GetPPC().Length() ; j++)
199 Standard_Integer OrdreConst = LScalarConst.GetPPC()(j).Idu() + LScalarConst.GetPPC()(j).Idv();
200 if(maxConstraintOrder<OrdreConst) maxConstraintOrder = OrdreConst;
204 void Plate_Plate::Load(const Plate_LineConstraint& LConst)
209 void Plate_Plate::Load(const Plate_PlaneConstraint& PConst)
214 void Plate_Plate::Load(const Plate_SampledCurveConstraint& SCConst)
216 Load(SCConst.LXYZC());
219 void Plate_Plate::Load(const Plate_GtoCConstraint& GtoCConst)
221 for(Standard_Integer i=0;i< GtoCConst.nb_PPC();i++)
222 Load(GtoCConst.GetPPC(i));
225 void Plate_Plate::Load(const Plate_FreeGtoCConstraint& FGtoCConst)
228 for( i=0;i< FGtoCConst.nb_PPC();i++)
229 Load(FGtoCConst.GetPPC(i));
230 for(i=0;i< FGtoCConst.nb_LSC();i++)
231 Load(FGtoCConst.LSC(i));
234 void Plate_Plate::Load(const Plate_GlobalTranslationConstraint& GTConst)
236 Load(GTConst.LXYZC());
239 //=======================================================================
241 //purpose : to solve the set of constraints
242 //=======================================================================
244 void Plate_Plate::SolveTI(const Standard_Integer ord,
245 const Standard_Real anisotropie,
246 const Message_ProgressRange& theProgress)
248 Standard_Integer IterationNumber=0;
254 if(anisotropie < 1.e-6) return;
255 if(anisotropie > 1.e+6) return;
257 // computation of the bounding box of the 2d PPconstraints
258 Standard_Real xmin,xmax,ymin,ymax;
259 UVBox(xmin,xmax,ymin,ymax);
261 Standard_Real du = 0.5*(xmax - xmin);
262 if(anisotropie >1.) du *= anisotropie;
263 if(du < 1.e-10) return;
266 for( i=1;i<=9;i++) ddu[i] = ddu[i-1] / du;
268 Standard_Real dv = 0.5*(ymax - ymin);
269 if(anisotropie <1.) dv /= anisotropie;
270 if(dv < 1.e-10) return;
272 for(i=1;i<=9;i++) ddv[i] = ddv[i-1] / dv;
274 if(myLScalarConstraints.IsEmpty())
276 if(myLXYZConstraints.IsEmpty())
277 SolveTI1(IterationNumber, theProgress);
279 SolveTI2(IterationNumber, theProgress);
282 SolveTI3(IterationNumber, theProgress);
286 //=======================================================================
287 //function : SolveTI1
288 //purpose : to solve the set of constraints in the easiest case,
289 // only PinPointConstraints are loaded
290 //=======================================================================
292 void Plate_Plate::SolveTI1(const Standard_Integer IterationNumber,
293 const Message_ProgressRange& theProgress)
295 // computation of square matrix members
298 n_dim = n_el + order*(order+1)/2;
299 math_Matrix mat(0, n_dim-1, 0, n_dim-1, 0.);
301 delete [] (gp_XY*)points;
302 points = new gp_XY[n_el];
304 for( i=0; i<n_el;i++) Points(i) = myConstraints(i+1).Pnt2d();
306 delete [] (Standard_Integer*)deru;
307 deru = new Standard_Integer[n_el];
308 for(i=0; i<n_el;i++) Deru(i) = myConstraints(i+1).Idu();
310 delete [] (Standard_Integer*)derv;
311 derv = new Standard_Integer[n_el];
312 for(i=0; i<n_el;i++) Derv(i) = myConstraints(i+1).Idv();
314 for(i=0; i<n_el;i++) {
315 for(Standard_Integer j=0;j<i;j++) {
316 Standard_Real signe = 1;
317 if ( ((Deru(j)+Derv(j))%2) == 1) signe = -1;
318 Standard_Integer iu = Deru(i) + Deru(j);
319 Standard_Integer iv = Derv(i) + Derv(j);
320 mat(i,j) = signe * SolEm(Points(i) - Points(j),iu,iv);
325 for(Standard_Integer iu = 0; iu< order; iu++) {
326 for(Standard_Integer iv =0; iu+iv < order; iv++) {
327 for(Standard_Integer j=0;j<n_el;j++) {
328 Standard_Integer idu = Deru(j);
329 Standard_Integer idv = Derv(j);
330 mat(i,j) = Polm (Points(j), iu, iv, idu, idv);
336 for(i=0;i<n_dim;i++) {
337 for(Standard_Integer j = i+1; j<n_dim;j++) {
342 // initialisation of the Gauss algorithm
343 Standard_Real pivot_max = 1.e-12;
346 Message_ProgressScope aScope (theProgress, "Plate_Plate::SolveTI1()", 10);
347 math_Gauss algo_gauss(mat,pivot_max, aScope.Next (7));
349 if (aScope.UserBreak())
355 if(!algo_gauss.IsDone()) {
356 Standard_Integer nbm = order*(order+1)/2;
357 for(i=n_el;i<n_el+nbm;i++) {
362 math_Gauss thealgo(mat,pivot_max, aScope.Next (3));
364 if (aScope.UserBreak())
369 algo_gauss = thealgo;
370 OK = algo_gauss.IsDone();
374 // computation of the linear system solution for the X, Y and Z coordinates
375 math_Vector sec_member( 0, n_dim-1, 0.);
376 math_Vector sol(0,n_dim-1);
378 delete [] (gp_XYZ*) solution;
379 solution = new gp_XYZ[n_dim];
381 for(Standard_Integer icoor=1; icoor<=3;icoor++) {
382 for(i=0;i<n_el;i++) {
383 sec_member(i) = myConstraints(i+1).Value().Coord(icoor);
385 algo_gauss.Solve(sec_member, sol);
386 //alr iteration pour affiner la solution
388 math_Vector sol1(0,n_dim-1);
389 math_Vector sec_member1(0,n_dim-1);
390 for(i=1;i<=IterationNumber;i++)
392 sec_member1 = sec_member - mat*sol;
393 algo_gauss.Solve(sec_member1, sol1);
399 for(i=0;i<n_dim;i++) {
400 Solution(i).SetCoord (icoor, sol(i));
406 //=======================================================================
407 //function : SolveTI2
408 //purpose : to solve the set of constraints in the medium case,
409 // LinearXYZ constraints are provided but no LinearScalar one
410 //=======================================================================
412 void Plate_Plate::SolveTI2(const Standard_Integer IterationNumber,
413 const Message_ProgressRange& theProgress)
415 // computation of square matrix members
417 Standard_Integer nCC1 = myConstraints.Length();
418 Standard_Integer nCC2 = 0;
420 for( i = 1; i<= myLXYZConstraints.Length(); i++)
421 nCC2 += myLXYZConstraints(i).Coeff().ColLength();
423 Standard_Integer n_dimat = nCC1 + nCC2 + order*(order+1)/2;
426 delete [] (gp_XY*)points;
427 points = new gp_XY[n_el];
428 delete [] (Standard_Integer*)deru;
429 deru = new Standard_Integer[n_el];
430 delete [] (Standard_Integer*)derv;
431 derv = new Standard_Integer[n_el];
434 for(i=0; i< nCC1;i++)
436 Points(i) = myConstraints(i+1).Pnt2d();
437 Deru(i) = myConstraints(i+1).Idu();
438 Derv(i) = myConstraints(i+1).Idv();
441 Standard_Integer k = nCC1;
442 for( i = 1; i<= myLXYZConstraints.Length(); i++)
443 for(Standard_Integer j=1;j <= myLXYZConstraints(i).GetPPC().Length() ; j++)
445 Points(k) = myLXYZConstraints(i).GetPPC()(j).Pnt2d();
446 Deru(k) = myLXYZConstraints(i).GetPPC()(j).Idu();
447 Derv(k) = myLXYZConstraints(i).GetPPC()(j).Idv();
451 math_Matrix mat(0, n_dimat-1, 0, n_dimat-1, 0.);
453 fillXYZmatrix(mat,0,0,nCC1,nCC2);
456 // initialisation of the Gauss algorithm
457 Standard_Real pivot_max = 1.e-12;
458 OK = Standard_True; // ************ JHH
460 Message_ProgressScope aScope (theProgress, "Plate_Plate::SolveTI2()", 10);
461 math_Gauss algo_gauss(mat,pivot_max, aScope.Next (7));
463 if (aScope.UserBreak())
469 if(!algo_gauss.IsDone()) {
470 for(i=nCC1+nCC2;i<n_dimat;i++) {
475 math_Gauss thealgo1(mat,pivot_max, aScope.Next (3));
477 if (aScope.UserBreak())
482 algo_gauss = thealgo1;
483 OK = algo_gauss.IsDone();
487 // computation of the linear system solution for the X, Y and Z coordinates
488 math_Vector sec_member( 0, n_dimat-1, 0.);
489 math_Vector sol(0,n_dimat-1);
491 delete [] (gp_XYZ*) solution;
492 n_dim = n_el+order*(order+1)/2;
493 solution = new gp_XYZ[n_dim];
495 for(Standard_Integer icoor=1; icoor<=3;icoor++) {
496 for(i=0;i<nCC1;i++) {
497 sec_member(i) = myConstraints(i+1).Value().Coord(icoor);
501 for(i = 1; i<= myLXYZConstraints.Length(); i++) {
502 for(Standard_Integer irow =1; irow <= myLXYZConstraints(i).Coeff().ColLength(); irow++) {
503 for(Standard_Integer icol=1; icol<=myLXYZConstraints(i).Coeff().RowLength();icol++)
504 sec_member(k) += myLXYZConstraints(i).Coeff()(irow,icol)
505 * myLXYZConstraints(i).GetPPC()(icol).Value().Coord(icoor);
510 algo_gauss.Solve(sec_member, sol);
511 //alr iteration pour affiner la solution
513 math_Vector sol1(0,n_dimat-1);
514 math_Vector sec_member1(0,n_dimat-1);
515 for(i=1;i<=IterationNumber;i++)
517 sec_member1 = sec_member - mat*sol;
518 algo_gauss.Solve(sec_member1, sol1);
524 for(i=0;i<nCC1;i++) Solution(i).SetCoord (icoor, sol(i));
526 Standard_Integer kSolution = nCC1;
527 Standard_Integer ksol = nCC1;
529 for(i = 1; i<= myLXYZConstraints.Length(); i++) {
530 for(Standard_Integer icol=1; icol<=myLXYZConstraints(i).Coeff().RowLength();icol++){
531 Standard_Real vsol = 0;
532 for(Standard_Integer irow =1; irow <= myLXYZConstraints(i).Coeff().ColLength(); irow++)
533 vsol += myLXYZConstraints(i).Coeff()(irow,icol)*sol(ksol+irow-1);
534 Solution(kSolution).SetCoord (icoor, vsol);
537 ksol += myLXYZConstraints(i).Coeff().ColLength();
540 for(i=0;i<order*(order+1)/2; i++) {
541 Solution(n_el+i).SetCoord (icoor, sol(ksol+i));
547 //=======================================================================
548 //function : SolveTI3
549 //purpose : to solve the set of constraints in the most general situation
550 //=======================================================================
552 void Plate_Plate::SolveTI3(const Standard_Integer IterationNumber,
553 const Message_ProgressRange& theProgress)
555 // computation of square matrix members
557 Standard_Integer nCC1 = myConstraints.Length();
559 Standard_Integer nCC2 = 0;
561 for( i = 1; i<= myLXYZConstraints.Length(); i++)
562 nCC2 += myLXYZConstraints(i).Coeff().ColLength();
564 Standard_Integer nCC3 = 0;
565 for(i = 1; i<= myLScalarConstraints.Length(); i++)
566 nCC3 += myLScalarConstraints(i).Coeff().ColLength();
568 Standard_Integer nbm = order*(order+1)/2;
569 Standard_Integer n_dimsousmat = nCC1 + nCC2 + nbm ;
570 Standard_Integer n_dimat =3*n_dimsousmat + nCC3;
573 delete [] (gp_XY*)points;
574 points = new gp_XY[n_el];
575 delete [] (Standard_Integer*)deru;
576 deru = new Standard_Integer[n_el];
577 delete [] (Standard_Integer*)derv;
578 derv = new Standard_Integer[n_el];
581 for(i=0; i< nCC1;i++)
583 Points(i) = myConstraints(i+1).Pnt2d();
584 Deru(i) = myConstraints(i+1).Idu();
585 Derv(i) = myConstraints(i+1).Idv();
588 Standard_Integer k = nCC1;
589 for(i = 1; i<= myLXYZConstraints.Length(); i++)
590 for(Standard_Integer j=1;j <= myLXYZConstraints(i).GetPPC().Length() ; j++)
592 Points(k) = myLXYZConstraints(i).GetPPC()(j).Pnt2d();
593 Deru(k) = myLXYZConstraints(i).GetPPC()(j).Idu();
594 Derv(k) = myLXYZConstraints(i).GetPPC()(j).Idv();
597 Standard_Integer nPPC2 = k;
598 for(i = 1; i<= myLScalarConstraints.Length(); i++)
599 for(Standard_Integer j=1;j <= myLScalarConstraints(i).GetPPC().Length() ; j++)
601 Points(k) = myLScalarConstraints(i).GetPPC()(j).Pnt2d();
602 Deru(k) = myLScalarConstraints(i).GetPPC()(j).Idu();
603 Derv(k) = myLScalarConstraints(i).GetPPC()(j).Idv();
607 math_Matrix mat(0, n_dimat-1, 0, n_dimat-1, 0.);
609 fillXYZmatrix(mat,0,0,nCC1,nCC2);
610 fillXYZmatrix(mat,n_dimsousmat,n_dimsousmat,nCC1,nCC2);
611 fillXYZmatrix(mat,2*n_dimsousmat,2*n_dimsousmat,nCC1,nCC2);
614 Standard_Integer kppc = nPPC2;
616 for(i = 1; i<= myLScalarConstraints.Length(); i++) {
617 for( j=0;j<nCC1;j++){
619 math_Vector vmat(1,myLScalarConstraints(i).GetPPC().Length());
621 for(Standard_Integer ippc=1;ippc <= myLScalarConstraints(i).GetPPC().Length() ; ippc++) {
622 Standard_Real signe = 1;
623 if ( ((Deru(j)+Derv(j))%2) == 1) signe = -1;
624 Standard_Integer iu = Deru(kppc+ippc-1) + Deru(j);
625 Standard_Integer iv = Derv(kppc+ippc-1) + Derv(j);
626 vmat(ippc) = signe * SolEm(Points(kppc+ippc-1) - Points(j),iu,iv);
629 for(Standard_Integer irow=1;irow <= myLScalarConstraints(i).Coeff().ColLength() ; irow++)
630 for(Standard_Integer icol=1;icol <= myLScalarConstraints(i).Coeff().RowLength() ; icol++){
631 mat(k+irow-1,j) += myLScalarConstraints(i).Coeff()(irow,icol).X()*vmat(icol);
632 mat(k+irow-1,n_dimsousmat+j) += myLScalarConstraints(i).Coeff()(irow,icol).Y()*vmat(icol);
633 mat(k+irow-1,2*n_dimsousmat+j) += myLScalarConstraints(i).Coeff()(irow,icol).Z()*vmat(icol);
637 Standard_Integer k2 = nCC1;
638 Standard_Integer kppc2 = nCC1;
639 Standard_Integer i2 ;
640 for( i2 = 1; i2<=myLXYZConstraints.Length() ; i2++){
642 math_Matrix tmpmat(1,myLScalarConstraints(i).GetPPC().Length(),1,myLXYZConstraints(i2).GetPPC().Length() );
644 for(Standard_Integer ippc=1;ippc <= myLScalarConstraints(i).GetPPC().Length() ; ippc++)
645 for(Standard_Integer ippc2=1;ippc2 <= myLXYZConstraints(i2).GetPPC().Length() ; ippc2++){
646 Standard_Real signe = 1;
647 if ( ((Deru(kppc2+ippc2-1)+Derv(kppc2+ippc2-1))%2) == 1) signe = -1;
648 Standard_Integer iu = Deru(kppc+ippc-1) + Deru(kppc2+ippc2-1);
649 Standard_Integer iv = Derv(kppc+ippc-1) + Derv(kppc2+ippc2-1);
650 tmpmat(ippc,ippc2) = signe * SolEm(Points(kppc+ippc-1) - Points(kppc2+ippc2-1),iu,iv);
653 for(Standard_Integer irow=1;irow <= myLScalarConstraints(i).Coeff().ColLength() ; irow++)
654 for(Standard_Integer irow2=1;irow2 <= myLXYZConstraints(i2).Coeff().ColLength() ; irow2++)
655 for(Standard_Integer icol=1;icol <= myLScalarConstraints(i).Coeff().RowLength() ; icol++)
656 for(Standard_Integer icol2=1;icol2 <= myLXYZConstraints(i2).Coeff().RowLength() ; icol2++){
657 mat(k+irow-1,k2+irow2-1) +=
658 myLScalarConstraints(i).Coeff()(irow,icol).X()*myLXYZConstraints(i2).Coeff()(irow2,icol2)*tmpmat(icol,icol2);
659 mat(k+irow-1,n_dimsousmat+k2+irow2-1) +=
660 myLScalarConstraints(i).Coeff()(irow,icol).Y()*myLXYZConstraints(i2).Coeff()(irow2,icol2)*tmpmat(icol,icol2);
661 mat(k+irow-1,2*n_dimsousmat+k2+irow2-1) +=
662 myLScalarConstraints(i).Coeff()(irow,icol).Z()*myLXYZConstraints(i2).Coeff()(irow2,icol2)*tmpmat(icol,icol2);
665 k2 += myLXYZConstraints(i2).Coeff().ColLength();
666 kppc2 += myLXYZConstraints(i2).Coeff().RowLength();
672 for(Standard_Integer iu = 0; iu< order; iu++)
673 for(Standard_Integer iv =0; iu+iv < order; iv++) {
675 math_Vector vmat(1,myLScalarConstraints(i).GetPPC().Length());
676 for(Standard_Integer ippc=1;ippc <= myLScalarConstraints(i).GetPPC().Length() ; ippc++){
677 Standard_Integer idu = Deru(kppc+ippc-1);
678 Standard_Integer idv = Derv(kppc+ippc-1);
679 vmat(ippc) = Polm (Points(kppc+ippc-1),iu,iv,idu,idv);
682 for(Standard_Integer irow=1;irow <= myLScalarConstraints(i).Coeff().ColLength() ; irow++)
683 for(Standard_Integer icol=1;icol <= myLScalarConstraints(i).Coeff().RowLength() ; icol++){
684 mat(k+irow-1,j) += myLScalarConstraints(i).Coeff()(irow,icol).X()*vmat(icol);
685 mat(k+irow-1,n_dimsousmat+j) += myLScalarConstraints(i).Coeff()(irow,icol).Y()*vmat(icol);
686 mat(k+irow-1,2*n_dimsousmat+j) += myLScalarConstraints(i).Coeff()(irow,icol).Z()*vmat(icol);
695 for(i2 = 1; i2<=i ; i2++){
697 math_Matrix tmpmat(1,myLScalarConstraints(i).GetPPC().Length(),1,myLScalarConstraints(i2).GetPPC().Length() );
699 for(Standard_Integer ippc=1;ippc <= myLScalarConstraints(i).GetPPC().Length() ; ippc++)
700 for(Standard_Integer ippc2=1;ippc2 <= myLScalarConstraints(i2).GetPPC().Length() ; ippc2++){
701 Standard_Real signe = 1;
702 if ( ((Deru(kppc2+ippc2-1)+Derv(kppc2+ippc2-1))%2) == 1) signe = -1;
703 Standard_Integer a_iu = Deru(kppc+ippc-1) + Deru(kppc2+ippc2-1);
704 Standard_Integer iv = Derv(kppc+ippc-1) + Derv(kppc2+ippc2-1);
705 tmpmat(ippc,ippc2) = signe * SolEm(Points(kppc+ippc-1) - Points(kppc2+ippc2-1),a_iu,iv);
708 for(Standard_Integer irow=1;irow <= myLScalarConstraints(i).Coeff().ColLength() ; irow++)
709 for(Standard_Integer irow2=1;irow2 <= myLScalarConstraints(i2).Coeff().ColLength() ; irow2++)
710 for(Standard_Integer icol=1;icol <= myLScalarConstraints(i).Coeff().RowLength() ; icol++)
711 for(Standard_Integer icol2=1;icol2 <= myLScalarConstraints(i2).Coeff().RowLength() ; icol2++){
712 mat(k+irow-1,k2+irow2-1) +=
713 myLScalarConstraints(i).Coeff()(irow,icol)*myLScalarConstraints(i2).Coeff()(irow2,icol2)*tmpmat(icol,icol2);
716 k2 += myLScalarConstraints(i2).Coeff().ColLength();
717 kppc2 += myLScalarConstraints(i2).Coeff().RowLength();
720 k += myLScalarConstraints(i).Coeff().ColLength();
721 kppc += myLScalarConstraints(i).Coeff().RowLength();
724 for( j=3*n_dimsousmat;j<n_dimat;j++)
730 // initialisation of the Gauss algorithm
731 Standard_Real pivot_max = 1.e-12;
732 OK = Standard_True; // ************ JHH
734 Message_ProgressScope aScope (theProgress, "Plate_Plate::SolveTI3()", 10);
735 math_Gauss algo_gauss(mat,pivot_max, aScope.Next (7));
737 if (aScope.UserBreak())
743 if(!algo_gauss.IsDone()) {
744 for(i=nCC1+nCC2;i<nCC1+nCC2+nbm;i++) {
746 mat(n_dimsousmat+i,n_dimsousmat+i) = 1.e-8;
747 mat(2*n_dimsousmat+i,2*n_dimsousmat+i) = 1.e-8;
751 math_Gauss thealgo2(mat,pivot_max, aScope.Next (3));
753 if (aScope.UserBreak())
758 algo_gauss = thealgo2;
759 OK = algo_gauss.IsDone();
763 // computation of the linear system solution for the X, Y and Z coordinates
764 math_Vector sec_member( 0, n_dimat-1, 0.);
765 math_Vector sol(0,n_dimat-1);
767 delete [] (gp_XYZ*) solution;
768 n_dim = n_el+order*(order+1)/2;
769 solution = new gp_XYZ[n_dim];
771 Standard_Integer icoor ;
772 for( icoor=1; icoor<=3;icoor++){
774 sec_member((icoor-1)*n_dimsousmat+i) = myConstraints(i+1).Value().Coord(icoor);
778 for(i = 1; i<= myLXYZConstraints.Length(); i++)
779 for(Standard_Integer irow =1; irow <= myLXYZConstraints(i).Coeff().ColLength(); irow++) {
780 for(Standard_Integer icol=1; icol<=myLXYZConstraints(i).Coeff().RowLength();icol++)
781 sec_member((icoor-1)*n_dimsousmat+k) += myLXYZConstraints(i).Coeff()(irow,icol)
782 * myLXYZConstraints(i).GetPPC()(icol).Value().Coord(icoor);
787 for(i = 1; i<= myLScalarConstraints.Length(); i++)
788 for(Standard_Integer irow =1; irow <= myLScalarConstraints(i).Coeff().ColLength(); irow++) {
789 for(Standard_Integer icol=1; icol<=myLScalarConstraints(i).Coeff().RowLength();icol++)
790 sec_member(k) += myLScalarConstraints(i).Coeff()(irow,icol)
791 * myLScalarConstraints(i).GetPPC()(icol).Value();
795 algo_gauss.Solve(sec_member, sol);
796 // iteration to refine the solution
798 math_Vector sol1(0,n_dimat-1);
799 math_Vector sec_member1(0,n_dimat-1);
800 for(i=1;i<=IterationNumber;i++)
802 sec_member1 = sec_member - mat*sol;
803 algo_gauss.Solve(sec_member1, sol1);
808 for(icoor=1; icoor<=3;icoor++){
809 for(i=0;i<nCC1;i++) Solution(i).SetCoord (icoor, sol((icoor-1)*n_dimsousmat+i));
811 Standard_Integer kSolution = nCC1;
812 Standard_Integer ksol = nCC1;
814 for(i = 1; i<= myLXYZConstraints.Length(); i++) {
815 for(Standard_Integer icol=1; icol<=myLXYZConstraints(i).Coeff().RowLength();icol++){
816 Standard_Real vsol = 0;
817 for(Standard_Integer irow =1; irow <= myLXYZConstraints(i).Coeff().ColLength(); irow++)
818 vsol += myLXYZConstraints(i).Coeff()(irow,icol)*sol((icoor-1)*n_dimsousmat+ksol+irow-1);
819 Solution(kSolution).SetCoord (icoor, vsol);
822 ksol += myLXYZConstraints(i).Coeff().ColLength();
826 for(i=0;i<order*(order+1)/2; i++) {
827 Solution(n_el+i).SetCoord (icoor, sol((icoor-1)*n_dimsousmat+ksol+i));
831 Standard_Integer ksol = 3*n_dimsousmat;
832 Standard_Integer kSolution = nPPC2;
833 for(i = 1; i<= myLScalarConstraints.Length(); i++) {
834 for(Standard_Integer icol=1; icol<=myLScalarConstraints(i).Coeff().RowLength();icol++){
835 gp_XYZ Vsol(0.,0.,0.);
836 for(Standard_Integer irow =1; irow <= myLScalarConstraints(i).Coeff().ColLength(); irow++)
837 Vsol += myLScalarConstraints(i).Coeff()(irow,icol)*sol(ksol+irow-1);
838 Solution(kSolution) = Vsol;
841 ksol += myLScalarConstraints(i).Coeff().ColLength();
846 //=======================================================================
847 //function : fillXYZmatrix
849 //=======================================================================
850 void Plate_Plate::fillXYZmatrix(math_Matrix &mat,
851 const Standard_Integer i0,
852 const Standard_Integer j0,
853 const Standard_Integer ncc1,
854 const Standard_Integer ncc2) const
856 Standard_Integer i,j ;
857 for( i=0; i<ncc1;i++) {
859 Standard_Real signe = 1;
860 if ( ((Deru(j)+Derv(j))%2) == 1) signe = -1;
861 Standard_Integer iu = Deru(i) + Deru(j);
862 Standard_Integer iv = Derv(i) + Derv(j);
863 mat(i0+i,j0+j) = signe * SolEm(Points(i) - Points(j),iu,iv);
867 Standard_Integer k = ncc1;
868 Standard_Integer kppc = ncc1;
869 for( i = 1; i<= myLXYZConstraints.Length(); i++){
871 for(Standard_Integer a_j=0; a_j < ncc1; a_j++){
873 math_Vector vmat(1,myLXYZConstraints(i).GetPPC().Length());
875 for(Standard_Integer ippc=1;ippc <= myLXYZConstraints(i).GetPPC().Length() ; ippc++) {
876 Standard_Real signe = 1;
877 if ( ((Deru(a_j)+Derv(a_j))%2) == 1) signe = -1;
878 Standard_Integer iu = Deru(kppc+ippc-1) + Deru(a_j);
879 Standard_Integer iv = Derv(kppc+ippc-1) + Derv(a_j);
880 vmat(ippc) = signe * SolEm(Points(kppc+ippc-1) - Points(a_j),iu,iv);
883 for(Standard_Integer irow=1;irow <= myLXYZConstraints(i).Coeff().ColLength() ; irow++)
884 for(Standard_Integer icol=1;icol <= myLXYZConstraints(i).Coeff().RowLength() ; icol++)
885 mat(i0+k+irow-1,j0+a_j) += myLXYZConstraints(i).Coeff()(irow,icol)*vmat(icol);
888 Standard_Integer k2 = ncc1;
889 Standard_Integer kppc2 = ncc1;
890 for(Standard_Integer i2 = 1; i2<= i; i2++){
892 math_Matrix tmpmat(1,myLXYZConstraints(i).GetPPC().Length(),1,myLXYZConstraints(i2).GetPPC().Length() );
894 for(Standard_Integer ippc=1;ippc <= myLXYZConstraints(i).GetPPC().Length() ; ippc++)
895 for(Standard_Integer ippc2=1;ippc2 <= myLXYZConstraints(i2).GetPPC().Length() ; ippc2++){
896 Standard_Real signe = 1;
897 if ( ((Deru(kppc2+ippc2-1)+Derv(kppc2+ippc2-1))%2) == 1) signe = -1;
898 Standard_Integer iu = Deru(kppc+ippc-1) + Deru(kppc2+ippc2-1);
899 Standard_Integer iv = Derv(kppc+ippc-1) + Derv(kppc2+ippc2-1);
900 tmpmat(ippc,ippc2) = signe * SolEm(Points(kppc+ippc-1) - Points(kppc2+ippc2-1),iu,iv);
903 for(Standard_Integer irow=1;irow <= myLXYZConstraints(i).Coeff().ColLength() ; irow++)
904 for(Standard_Integer irow2=1;irow2 <= myLXYZConstraints(i2).Coeff().ColLength() ; irow2++)
905 for(Standard_Integer icol=1;icol <= myLXYZConstraints(i).Coeff().RowLength() ; icol++)
906 for(Standard_Integer icol2=1;icol2 <= myLXYZConstraints(i2).Coeff().RowLength() ; icol2++)
907 mat(i0+k+irow-1,j0+k2+irow2-1) +=
908 myLXYZConstraints(i).Coeff()(irow,icol)*myLXYZConstraints(i2).Coeff()(irow2,icol2)*tmpmat(icol,icol2);
911 k2 += myLXYZConstraints(i2).Coeff().ColLength();
912 kppc2 += myLXYZConstraints(i2).Coeff().RowLength();
915 k += myLXYZConstraints(i).Coeff().ColLength();
916 kppc += myLXYZConstraints(i).Coeff().RowLength();
923 for(Standard_Integer iu = 0; iu< order; iu++)
924 for(Standard_Integer iv =0; iu+iv < order; iv++) {
925 for(Standard_Integer a_j=0; a_j < ncc1; a_j++) {
926 Standard_Integer idu = Deru(a_j);
927 Standard_Integer idv = Derv(a_j);
928 mat(i0+i,j0+a_j) = Polm (Points(a_j), iu, iv, idu, idv);
931 Standard_Integer k2 = ncc1;
932 Standard_Integer kppc2 = ncc1;
933 for(Standard_Integer i2 = 1; i2<= myLXYZConstraints.Length(); i2++){
934 math_Vector vmat(1,myLXYZConstraints(i2).GetPPC().Length());
935 for(Standard_Integer ippc2=1;ippc2 <= myLXYZConstraints(i2).GetPPC().Length() ; ippc2++){
936 Standard_Integer idu = Deru(kppc2+ippc2-1);
937 Standard_Integer idv = Derv(kppc2+ippc2-1);
938 vmat(ippc2) = Polm (Points(kppc2+ippc2-1),iu,iv,idu,idv);
941 for(Standard_Integer irow2=1;irow2 <= myLXYZConstraints(i2).Coeff().ColLength() ; irow2++)
942 for(Standard_Integer icol2=1;icol2 <= myLXYZConstraints(i2).Coeff().RowLength() ; icol2++)
943 mat(i0+i,j0+k2+irow2-1) += myLXYZConstraints(i2).Coeff()(irow2,icol2)*vmat(icol2);
945 k2 += myLXYZConstraints(i2).Coeff().ColLength();
946 kppc2 += myLXYZConstraints(i2).Coeff().RowLength();
952 Standard_Integer n_dimat = ncc1 + ncc2 + order*(order+1)/2;
954 for(i=0;i<n_dimat;i++) {
955 for(Standard_Integer a_j = i+1; a_j < n_dimat; a_j++) {
956 mat(i0+i,j0+a_j) = mat(i0+a_j,j0+i);
962 //=======================================================================
965 //=======================================================================
967 Standard_Boolean Plate_Plate::IsDone() const
973 //=======================================================================
976 //=======================================================================
978 void Plate_Plate::destroy()
983 //=======================================================================
986 //=======================================================================
988 void Plate_Plate::Init()
990 myConstraints.Clear();
991 myLXYZConstraints.Clear();
992 myLScalarConstraints.Clear();
995 delete [] (gp_XYZ*)solution;
998 delete [] (gp_XY*)points;
1001 delete [] (Standard_Integer*)deru;
1004 delete [] (Standard_Integer*)derv;
1011 maxConstraintOrder=0;
1014 //=======================================================================
1015 //function : Evaluate
1017 //=======================================================================
1019 gp_XYZ Plate_Plate::Evaluate(const gp_XY& point2d) const
1021 if(solution == 0) return gp_XYZ(0,0,0);
1022 if(!OK) return gp_XYZ(0,0,0);
1024 gp_XYZ valeur(0,0,0);
1026 if(!PolynomialPartOnly)
1028 for(Standard_Integer i=0; i<n_el;i++)
1030 Standard_Real signe = 1;
1031 if ( ((Deru(i)+Derv(i))%2) == 1) signe = -1;
1032 valeur += Solution(i) * (signe*SolEm(point2d - Points(i), Deru(i), Derv(i))) ;
1035 Standard_Integer i = n_el;
1036 for(Standard_Integer idu = 0; idu< order; idu++)
1037 for(Standard_Integer idv =0; idu+idv < order; idv++)
1039 valeur += Solution(i) * Polm( point2d, idu,idv,0,0);
1045 //=======================================================================
1046 //function : EvaluateDerivative
1048 //=======================================================================
1050 gp_XYZ Plate_Plate::EvaluateDerivative(const gp_XY& point2d, const Standard_Integer iu, const Standard_Integer iv) const
1052 if(solution == 0) return gp_XYZ(0,0,0);
1053 if(!OK) return gp_XYZ(0,0,0);
1055 gp_XYZ valeur(0,0,0);
1056 if(!PolynomialPartOnly)
1058 for(Standard_Integer i=0; i<n_el;i++)
1060 Standard_Real signe = 1;
1061 if ( ((Deru(i)+Derv(i))%2) == 1) signe = -1;
1062 valeur += Solution(i) * (signe*SolEm(point2d - Points(i), Deru(i)+iu, Derv(i)+iv)) ;
1065 Standard_Integer i = n_el;
1066 for(Standard_Integer idu = 0; idu< order; idu++)
1067 for(Standard_Integer idv =0; idu+idv < order; idv++)
1069 valeur += Solution(i) * Polm( point2d, idu,idv, iu,iv);
1074 //=======================================================================
1075 //function : Plate_Plate::CoefPol
1076 //purpose : give back the array of power basis coefficient of
1077 // the polynomial part of the Plate function
1078 //=======================================================================
1080 void Plate_Plate::CoefPol(Handle(TColgp_HArray2OfXYZ)& Coefs) const
1082 Coefs = new TColgp_HArray2OfXYZ(0,order-1,0,order-1,gp_XYZ(0.,0.,0.));
1083 Standard_Integer i = n_el;
1084 for(Standard_Integer iu = 0; iu< order; iu++)
1085 for(Standard_Integer iv =0; iu+iv < order; iv++)
1087 Coefs->ChangeValue(iu,iv) = Solution(i)*ddu[iu]*ddv[iv];
1088 //Coefs->ChangeValue(idu,idv) = Solution(i);
1089 // it is necessary to reset this line if one remove factors in method Polm.
1094 //=======================================================================
1095 //function : Plate_Plate::Continuity
1096 //purpose : give back the continuity order of the Plate function
1097 //=======================================================================
1099 Standard_Integer Plate_Plate::Continuity() const
1101 return 2*order - 3 - maxConstraintOrder;
1104 //=======================================================================
1105 //function : Plate_Plate::SolEm
1106 //purpose : compute the (iu,iv)th derivative of the fundamental solution
1107 // of Laplcian at the power order
1108 //=======================================================================
1111 Standard_Real Plate_Plate::SolEm(const gp_XY& point2d, const Standard_Integer iu, const Standard_Integer iv) const
1113 Plate_Plate* aThis = const_cast<Plate_Plate*>(this);
1115 Standard_Integer IU,IV;
1119 // SolEm is symmetric in (u<->v) : we swap u and v if iv>iu
1120 // to avoid some code
1123 U = point2d.Y() *ddv[1];
1124 V = point2d.X() *ddu[1];
1130 U = point2d.X() *ddu[1];
1131 V = point2d.Y() *ddv[1];
1134 if((U==Uold)&&(V==Vold) )
1136 if (R<1.e-20) return 0;
1144 if (R<1.e-20) return 0;
1147 Standard_Real DUV = 0;
1149 Standard_Integer m = order;
1150 Standard_Integer mm1 = m-1;
1151 Standard_Real &r = aThis->R;
1154 //Standard_Real pr = pow(R, mm1 - IU - IV);
1155 // this expression takes a lot of time
1156 //(does not take into account a small integer value of the exponent)
1159 Standard_Integer expo = mm1 - IU - IV;
1164 for(Standard_Integer i=1;i<-expo;i++) pr *= R;
1170 for(Standard_Integer i=1;i<expo;i++) pr *= R;
1196 DUV = 2*pr*U*(1+L*mm1);
1202 Standard_Real m2 = m*m;
1203 //DUV = 4*pr*U*V*(-3+2*L+2*m-3*L*m+L*m2);
1204 DUV = 4*pr*U*V*((2*m-3)+(m2-3*m+2)*L);
1218 Standard_Real m2 = m*m;
1219 DUV = 2*pr*(R-L*R+L*m*R-6*U2+4*L*U2+4*m*U2-6*L*m*U2+2*L*m2*U2);
1225 Standard_Real m2 = m*m;
1226 Standard_Real m3 = m2*m;
1227 DUV = -3*R+2*L*R+2*m*R-3*L*m*R+L*m2*R+22*U2-12*L*U2-24*m*U2+22*L*m*U2+6*m2*U2-12*L*m2*U2+2*L*m3*U2;
1228 DUV = DUV * 4* pr*V;
1234 Standard_Real m2 = m*m;
1235 Standard_Real m3 = m2*m;
1236 Standard_Real m4 = m2*m2;
1237 Standard_Real V2 = V*V;
1238 Standard_Real R2 = R*R;
1239 DUV = -3*R2+2*L*R2+2*m*R2-3*L*m*R2+L*m2*R2+22*R*U2-12*L*R*U2-24*m*R*U2+22*L*m*R*U2+6*m2*R*U2-12*L*m2*R*U2;
1240 DUV += 2*L*m3*R*U2+22*R*V2-12*L*R*V2-24*m*R*V2+22*L*m*R*V2+6*m2*R*V2-12*L*m2*R*V2+2*L*m3*R*V2-200*U2*V2+96*L*U2*V2;
1241 DUV += 280*m*U2*V2-200*L*m*U2*V2-120*m2*U2*V2+140*L*m2*U2*V2+16*m3*U2*V2-40*L*m3*U2*V2+4*L*m4*U2*V2;
1256 Standard_Real m2 = m*m;
1257 Standard_Real m3 = m2*m;
1258 DUV = -9*R+6*L*R+6*m*R-9*L*m*R+3*L*m2*R+22*U2-12*L*U2-24*m*U2+22*L*m*U2+6*m2*U2-12*L*m2*U2+2*L*m3*U2;
1259 DUV = DUV * 4* pr*U;
1265 Standard_Real m2 = m*m;
1266 Standard_Real m3 = m2*m;
1267 Standard_Real m4 = m2*m2;
1268 DUV = 33*R-18*L*R-36*m*R+33*L*m*R+9*m2*R-18*L*m2*R+3*L*m3*R-100*U2+48*L*U2+140*m*U2-100*L*m*U2-60*m2*U2+70*L*m2*U2;
1269 DUV += 8*m3*U2-20*L*m3*U2+2*L*m4*U2;
1276 Standard_Real m2 = m*m;
1277 Standard_Real m3 = m2*m;
1278 Standard_Real m4 = m2*m2;
1279 Standard_Real m5 = m4*m;
1280 Standard_Real ru2 = R*U2;
1281 Standard_Real v2 = V*V;
1282 Standard_Real rv2 = R*v2;
1283 Standard_Real u2v2 = v2*U2;
1284 Standard_Real r2 = r*r;
1286 // copy-paste the mathematics
1288 -100*ru2 + 48*L*ru2 + 140*m*ru2 - 100*L*m*ru2 - 60*m2*ru2 + 70*L*m2*ru2 + 8*m3*ru2 -
1289 20*L*m3*ru2 + 2*L*m4*ru2 - 300*rv2 + 144*L*rv2 + 420*m*rv2 - 300*L*m*rv2 - 180*m2*rv2 + 210*L*m2*rv2 +
1290 24*m3*rv2 - 60*L*m3*rv2 + 6*L*m4*rv2 + 33*r2 - 18*L*r2 - 36*m*r2 + 33*L*m*r2 + 9*m2*r2 - 18*L*m2*r2 +
1291 3*L*m3*r2 + 1096*u2v2 - 480*L*u2v2 - 1800*m*u2v2 + 1096*L*m*u2v2 + 1020*m2*u2v2 - 900*L*m2*u2v2 -
1292 240*m3*u2v2 + 340*L*m3*u2v2 + 20*m4*u2v2 - 60*L*m4*u2v2 + 4*L*m5*u2v2;
1300 Standard_Real m2 = m*m;
1301 Standard_Real m3 = m2*m;
1302 Standard_Real m4 = m2*m2;
1303 Standard_Real m5 = m3*m2;
1304 Standard_Real m6 = m3*m3;
1305 Standard_Real ru2 = r*U2;
1306 Standard_Real v2 = V*V;
1307 Standard_Real rv2 = R*v2;
1308 Standard_Real u2v2 = v2*U2;
1309 Standard_Real r2 = r*r;
1311 // copy-paste the mathematics
1313 1644*ru2 - 720*L*ru2 - 2700*m*ru2 + 1644*L*m*ru2 + 1530*m2*ru2 - 1350*L*m2*ru2 -
1314 360*m3*ru2 + 510*L*m3*ru2 + 30*m4*ru2 - 90*L*m4*ru2 + 6*L*m5*ru2 + 1644*rv2 - 720*L*rv2 - 2700*m*rv2 +
1315 1644*L*m*rv2 + 1530*m2*rv2 - 1350*L*m2*rv2 - 360*m3*rv2 + 510*L*m3*rv2 + 30*m4*rv2 - 90*L*m4*rv2 +
1316 6*L*m5*rv2 - 450*r2 + 216*L*r2 + 630*m*r2 - 450*L*m*r2 - 270*m2*r2 + 315*L*m2*r2 + 36*m3*r2 - 90*L*m3*r2 +
1317 9*L*m4*r2 - 7056*u2v2 + 2880*L*u2v2 + 12992*m*u2v2 - 7056*L*m*u2v2 - 8820*m2*u2v2 + 6496*L*m2*u2v2 +
1318 2800*m3*u2v2 - 2940*L*m3*u2v2 - 420*m4*u2v2 + 700*L*m4*u2v2 + 24*m5*u2v2 - 84*L*m5*u2v2 + 4*L*m6*u2v2;
1320 DUV = 16*pr*U*V*DUV;
1334 Standard_Real m2 = m*m;
1335 Standard_Real m3 = m2*m;
1336 Standard_Real m4 = m2*m2;
1337 Standard_Real U4 = U2*U2;
1338 Standard_Real R2 = R*R;
1339 DUV = -9*R2+6*L*R2+6*m*R2-9*L*m*R2+3*L*m2*R2+132*R*U2-72*L*R*U2-144*m*R*U2+132*L*m*R*U2+36*m2*R*U2-72*L*m2*R*U2;
1340 DUV += 12*L*m3*R*U2-200*U4+96*L*U4+280*m*U4-200*L*m*U4-120*m2*U4+140*L*m2*U4+16*m3*U4-40*L*m3*U4+4*L*m4*U4;
1347 Standard_Real m2 = m*m;
1348 Standard_Real m3 = m2*m;
1349 Standard_Real m4 = m2*m2;
1350 Standard_Real m5 = m2*m3;
1351 Standard_Real u4 = U2*U2;
1352 Standard_Real ru2 = R*U2;
1353 Standard_Real r2 = R*R;
1355 // copy-paste the mathematics
1357 -600*ru2 + 288*L*ru2 + 840*m*ru2 - 600*L*m*ru2 - 360*m2*ru2 + 420*L*m2*ru2 + 48*m3*ru2 -
1358 120*L*m3*ru2 + 12*L*m4*ru2 + 33*r2 - 18*L*r2 - 36*m*r2 + 33*L*m*r2 + 9*m2*r2 - 18*L*m2*r2 + 3*L*m3*r2 +
1359 1096*u4 - 480*L*u4 - 1800*m*u4 + 1096*L*m*u4 + 1020*m2*u4 - 900*L*m2*u4 - 240*m3*u4 + 340*L*m3*u4 + 20*m4*u4 -
1360 60*L*m4*u4 + 4*L*m5*u4;
1368 Standard_Real m2 = m*m;
1369 Standard_Real m3 = m2*m;
1370 Standard_Real m4 = m2*m2;
1371 Standard_Real m5 = m2*m3;
1372 Standard_Real m6 = m3*m3;
1373 Standard_Real u4 = U2*U2;
1374 Standard_Real r2 = r*r;
1375 Standard_Real r3 = r2*r;
1376 Standard_Real v2 = V*V;
1377 Standard_Real u2v2 = v2*U2;
1378 Standard_Real ru2v2 = R*u2v2;
1379 Standard_Real u4v2 = u4*v2;
1380 Standard_Real r2u2 = r2*U2;
1381 Standard_Real ru4 = r*u4;
1382 Standard_Real r2v2 = r2*v2;
1384 // copy-paste the mathematics
1386 6576*ru2v2 - 2880*L*ru2v2 - 10800*m*ru2v2 + 6576*L*m*ru2v2 + 6120*m2*ru2v2 - 5400*L*m2*ru2v2 -
1387 1440*m3*ru2v2 + 2040*L*m3*ru2v2 + 120*m4*ru2v2 - 360*L*m4*ru2v2 + 24*L*m5*ru2v2 + 1096*ru4 - 480*L*ru4 -
1388 1800*m*ru4 + 1096*L*m*ru4 + 1020*m2*ru4 - 900*L*m2*ru4 - 240*m3*ru4 + 340*L*m3*ru4 + 20*m4*ru4 - 60*L*m4*ru4 +
1389 4*L*m5*ru4 - 600*r2u2 + 288*L*r2u2 + 840*m*r2u2 - 600*L*m*r2u2 - 360*m2*r2u2 + 420*L*m2*r2u2 + 48*m3*r2u2 -
1390 120*L*m3*r2u2 + 12*L*m4*r2u2 - 300*r2v2 + 144*L*r2v2 + 420*m*r2v2 - 300*L*m*r2v2 - 180*m2*r2v2 + 210*L*m2*r2v2 +
1391 24*m3*r2v2 - 60*L*m3*r2v2 + 6*L*m4*r2v2 + 33*r3 - 18*L*r3 - 36*m*r3 + 33*L*m*r3 + 9*m2*r3 - 18*L*m2*r3 +
1392 3*L*m3*r3 - 14112*u4v2 + 5760*L*u4v2 + 25984*m*u4v2 - 14112*L*m*u4v2 - 17640*m2*u4v2 + 12992*L*m2*u4v2 +
1393 5600*m3*u4v2 - 5880*L*m3*u4v2 - 840*m4*u4v2 + 1400*L*m4*u4v2 + 48*m5*u4v2 - 168*L*m5*u4v2 + 8*L*m6*u4v2;
1401 Standard_Real m2 = m*m;
1402 Standard_Real m3 = m2*m;
1403 Standard_Real m4 = m2*m2;
1404 Standard_Real m5 = m2*m3;
1405 Standard_Real m6 = m3*m3;
1406 Standard_Real m7 = m3*m4;
1407 Standard_Real u4 = U2*U2;
1408 Standard_Real r2 = r*r;
1409 Standard_Real r3 = r2*r;
1410 Standard_Real v2 = V*V;
1411 Standard_Real u2v2 = v2*U2;
1412 Standard_Real ru2v2 = R*u2v2;
1413 Standard_Real u4v2 = u4*v2;
1414 Standard_Real r2u2 = r2*U2;
1415 Standard_Real r2v2 = r2*v2;
1416 Standard_Real ru4 = r*u4;
1418 // copy-paste the mathematics
1420 -42336*ru2v2 + 17280*L*ru2v2 + 77952*m*ru2v2 - 42336*L*m*ru2v2 - 52920*m2*ru2v2 +
1421 38976*L*m2*ru2v2 + 16800*m3*ru2v2 - 17640*L*m3*ru2v2 - 2520*m4*ru2v2 + 4200*L*m4*ru2v2 + 144*m5*ru2v2 -
1422 504*L*m5*ru2v2 + 24*L*m6*ru2v2 - 21168*ru4 + 8640*L*ru4 + 38976*m*ru4 - 21168*L*m*ru4 - 26460*m2*ru4 +
1423 19488*L*m2*ru4 + 8400*m3*ru4 - 8820*L*m3*ru4 - 1260*m4*ru4 + 2100*L*m4*ru4 + 72*m5*ru4 - 252*L*m5*ru4 +
1424 12*L*m6*ru4 + 9864*r2u2 - 4320*L*r2u2 - 16200*m*r2u2 + 9864*L*m*r2u2 + 9180*m2*r2u2 - 8100*L*m2*r2u2 -
1425 2160*m3*r2u2 + 3060*L*m3*r2u2 + 180*m4*r2u2 - 540*L*m4*r2u2 + 36*L*m5*r2u2 + 1644*r2v2 - 720*L*r2v2 -
1426 2700*m*r2v2 + 1644*L*m*r2v2 + 1530*m2*r2v2 - 1350*L*m2*r2v2 - 360*m3*r2v2 + 510*L*m3*r2v2 + 30*m4*r2v2 -
1427 90*L*m4*r2v2 + 6*L*m5*r2v2 - 450*r3 + 216*L*r3 + 630*m*r3 - 450*L*m*r3 - 270*m2*r3 + 315*L*m2*r3 + 36*m3*r3 -
1428 90*L*m3*r3 + 9*L*m4*r3 + 104544*u4v2 - 40320*L*u4v2 - 210112*m*u4v2 + 104544*L*m*u4v2 + 162456*m2*u4v2 -
1429 105056*L*m2*u4v2 - 62720*m3*u4v2 + 54152*L*m3*u4v2 + 12880*m4*u4v2 - 15680*L*m4*u4v2 - 1344*m5*u4v2 +
1430 2576*L*m5*u4v2 + 56*m6*u4v2 - 224*L*m6*u4v2 + 8*L*m7*u4v2;
1446 Standard_Real m2 = m*m;
1447 Standard_Real m3 = m2*m;
1448 Standard_Real m4 = m2*m2;
1449 Standard_Real m5 = m2*m3;
1450 Standard_Real u4 = U2*U2;
1451 Standard_Real r2 = R*R;
1452 Standard_Real ru2 = R*U2;
1454 // copy-paste the mathematics
1456 -1000*ru2 + 480*L*ru2 + 1400*m*ru2 - 1000*L*m*ru2 - 600*m2*ru2 + 700*L*m2*ru2 + 80*m3*ru2 -
1457 200*L*m3*ru2 + 20*L*m4*ru2 + 165*r2 - 90*L*r2 - 180*m*r2 + 165*L*m*r2 + 45*m2*r2 - 90*L*m2*r2 + 15*L*m3*r2 +
1458 1096*u4 - 480*L*u4 - 1800*m*u4 + 1096*L*m*u4 + 1020*m2*u4 - 900*L*m2*u4 - 240*m3*u4 + 340*L*m3*u4 + 20*m4*u4 -
1459 60*L*m4*u4 + 4*L*m5*u4;
1467 Standard_Real m2 = m*m;
1468 Standard_Real m3 = m2*m;
1469 Standard_Real m4 = m2*m2;
1470 Standard_Real m5 = m2*m3;
1471 Standard_Real m6 = m3*m3;
1472 Standard_Real u4 = U2*U2;
1473 Standard_Real ru2 = r*U2;
1474 Standard_Real r2 = r*r;
1477 // copy-paste the mathematics
1479 5480*ru2 - 2400*L*ru2 - 9000*m*ru2 + 5480*L*m*ru2 + 5100*m2*ru2 - 4500*L*m2*ru2 - 1200*m3*ru2 +
1480 1700*L*m3*ru2 + 100*m4*ru2 - 300*L*m4*ru2 + 20*L*m5*ru2 - 750*r2 + 360*L*r2 + 1050*m*r2 - 750*L*m*r2 -
1481 450*m2*r2 + 525*L*m2*r2 + 60*m3*r2 - 150*L*m3*r2 + 15*L*m4*r2 - 7056*u4 + 2880*L*u4 + 12992*m*u4 - 7056*L*m*u4 -
1482 8820*m2*u4 + 6496*L*m2*u4 + 2800*m3*u4 - 2940*L*m3*u4 - 420*m4*u4 + 700*L*m4*u4 + 24*m5*u4 - 84*L*m5*u4 +
1485 DUV = 16*pr*U*V*DUV;
1491 Standard_Real m2 = m*m;
1492 Standard_Real m3 = m2*m;
1493 Standard_Real m4 = m2*m2;
1494 Standard_Real m5 = m2*m3;
1495 Standard_Real m6 = m3*m3;
1496 Standard_Real m7 = m3*m4;
1497 Standard_Real u4 = U2*U2;
1498 Standard_Real r2 = r*r;
1499 Standard_Real r3 = r2*r;
1500 Standard_Real v2 = V*V;
1501 Standard_Real u2v2 = v2*U2;
1502 Standard_Real ru2v2 = R*u2v2;
1503 Standard_Real u4v2 = u4*v2;
1504 Standard_Real r2u2 = r2*U2;
1505 Standard_Real r2v2 = r2*v2;
1506 Standard_Real ru4 = r*u4;
1508 // copy-paste the mathematics
1511 -70560*ru2v2 + 28800*L*ru2v2 + 129920*m*ru2v2 - 70560*L*m*ru2v2 - 88200*m2*ru2v2 +
1512 64960*L*m2*ru2v2 + 28000*m3*ru2v2 - 29400*L*m3*ru2v2 - 4200*m4*ru2v2 + 7000*L*m4*ru2v2 + 240*m5*ru2v2 -
1513 840*L*m5*ru2v2 + 40*L*m6*ru2v2 - 7056*ru4 + 2880*L*ru4 + 12992*m*ru4 - 7056*L*m*ru4 - 8820*m2*ru4 +
1514 6496*L*m2*ru4 + 2800*m3*ru4 - 2940*L*m3*ru4 - 420*m4*ru4 + 700*L*m4*ru4 + 24*m5*ru4 - 84*L*m5*ru4 + 4*L*m6*ru4 +
1515 5480*r2u2 - 2400*L*r2u2 - 9000*m*r2u2 + 5480*L*m*r2u2 + 5100*m2*r2u2 - 4500*L*m2*r2u2 - 1200*m3*r2u2 +
1516 1700*L*m3*r2u2 + 100*m4*r2u2 - 300*L*m4*r2u2 + 20*L*m5*r2u2 + 8220*r2v2 - 3600*L*r2v2 - 13500*m*r2v2 +
1517 8220*L*m*r2v2 + 7650*m2*r2v2 - 6750*L*m2*r2v2 - 1800*m3*r2v2 + 2550*L*m3*r2v2 + 150*m4*r2v2 - 450*L*m4*r2v2 +
1518 30*L*m5*r2v2 - 750*r3 + 360*L*r3 + 1050*m*r3 - 750*L*m*r3 - 450*m2*r3 + 525*L*m2*r3 + 60*m3*r3 - 150*L*m3*r3 +
1519 15*L*m4*r3 + 104544*u4v2 - 40320*L*u4v2 - 210112*m*u4v2 + 104544*L*m*u4v2 + 162456*m2*u4v2 - 105056*L*m2*u4v2 -
1520 62720*m3*u4v2 + 54152*L*m3*u4v2 + 12880*m4*u4v2 - 15680*L*m4*u4v2 - 1344*m5*u4v2 + 2576*L*m5*u4v2 + 56*m6*u4v2 -
1521 224*L*m6*u4v2 + 8*L*m7*u4v2;
1537 Standard_Real m2 = m*m;
1538 Standard_Real m3 = m2*m;
1539 Standard_Real m4 = m2*m2;
1540 Standard_Real m5 = m2*m3;
1541 Standard_Real m6 = m3*m3;
1542 Standard_Real u4 = U2*U2;
1543 Standard_Real u6 = U2*u4;
1544 Standard_Real r2 = r*r;
1545 Standard_Real r3 = r2*r;
1546 Standard_Real r2u2 = r2*U2;
1547 Standard_Real ru4 = r*u4;
1549 // copy-paste the mathematics
1551 16440*ru4 - 7200*L*ru4 - 27000*m*ru4 + 16440*L*m*ru4 + 15300*m2*ru4 - 13500*L*m2*ru4 -
1552 3600*m3*ru4 + 5100*L*m3*ru4 + 300*m4*ru4 - 900*L*m4*ru4 + 60*L*m5*ru4 - 4500*r2u2 + 2160*L*r2u2 + 6300*m*r2u2 -
1553 4500*L*m*r2u2 - 2700*m2*r2u2 + 3150*L*m2*r2u2 + 360*m3*r2u2 - 900*L*m3*r2u2 + 90*L*m4*r2u2 + 165*r3 - 90*L*r3 -
1554 180*m*r3 + 165*L*m*r3 + 45*m2*r3 - 90*L*m2*r3 + 15*L*m3*r3 - 14112*u6 + 5760*L*u6 + 25984*m*u6 - 14112*L*m*u6 -
1555 17640*m2*u6 + 12992*L*m2*u6 + 5600*m3*u6 - 5880*L*m3*u6 - 840*m4*u6 + 1400*L*m4*u6 + 48*m5*u6 - 168*L*m5*u6 +
1571 return DUV * ddu[iu]*ddv[iv];
1576 //=======================================================================
1579 //=======================================================================
1581 void Plate_Plate::UVBox(Standard_Real& UMin, Standard_Real& UMax,
1582 Standard_Real& VMin, Standard_Real& VMax) const
1584 Standard_Integer i ;
1585 const Standard_Real Bmin = 1.e-3;
1586 UMin = myConstraints(1).Pnt2d().X();
1588 VMin = myConstraints(1).Pnt2d().Y();
1591 for( i=2; i<=myConstraints.Length();i++)
1593 Standard_Real x = myConstraints(i).Pnt2d().X();
1594 if(x<UMin) UMin = x;
1595 if(x>UMax) UMax = x;
1596 Standard_Real y = myConstraints(i).Pnt2d().Y();
1597 if(y<VMin) VMin = y;
1598 if(y>VMax) VMax = y;
1601 for(i=1; i<=myLXYZConstraints.Length();i++)
1602 for(Standard_Integer j=1;j<= myLXYZConstraints(i).GetPPC().Length(); j++)
1604 Standard_Real x = myLXYZConstraints(i).GetPPC()(j).Pnt2d().X();
1605 if(x<UMin) UMin = x;
1606 if(x>UMax) UMax = x;
1607 Standard_Real y = myLXYZConstraints(i).GetPPC()(j).Pnt2d().Y();
1608 if(y<VMin) VMin = y;
1609 if(y>VMax) VMax = y;
1612 for(i=1; i<=myLScalarConstraints.Length();i++)
1613 for(Standard_Integer j=1;j<= myLScalarConstraints(i).GetPPC().Length(); j++)
1615 Standard_Real x = myLScalarConstraints(i).GetPPC()(j).Pnt2d().X();
1616 if(x<UMin) UMin = x;
1617 if(x>UMax) UMax = x;
1618 Standard_Real y = myLScalarConstraints(i).GetPPC()(j).Pnt2d().Y();
1619 if(y<VMin) VMin = y;
1620 if(y>VMax) VMax = y;
1624 if(UMax-UMin < Bmin)
1626 Standard_Real UM = 0.5*(UMin+UMax);
1627 UMin = UM - 0.5*Bmin;
1628 UMax = UM + 0.5*Bmin;
1630 if(VMax-VMin < Bmin)
1632 Standard_Real VM = 0.5*(VMin+VMax);
1633 VMin = VM - 0.5*Bmin;
1634 VMax = VM + 0.5*Bmin;
1638 //=======================================================================
1639 //function : UVConstraints
1641 //=======================================================================
1643 void Plate_Plate::UVConstraints(TColgp_SequenceOfXY& Seq) const
1645 for (Standard_Integer i=1;i<=myConstraints.Length();i++) {
1646 if ((myConstraints.Value(i).Idu()==0) && (myConstraints.Value(i).Idv()==0))
1647 Seq.Append((myConstraints.Value(i)).Pnt2d());
1650 //=======================================================================
1652 void Plate_Plate::SetPolynomialPartOnly(const Standard_Boolean PPOnly)
1654 PolynomialPartOnly = PPOnly;