1 // Created on: 1995-10-18
2 // Created by: Andre LIEUTIER
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16 
17 #ifndef _Plate_Plate_HeaderFile
18 #define _Plate_Plate_HeaderFile
19 
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23 
24 #include <Standard_Integer.hxx>
25 #include <Standard_Address.hxx>
26 #include <Standard_Boolean.hxx>
27 #include <Plate_SequenceOfPinpointConstraint.hxx>
28 #include <Plate_SequenceOfLinearXYZConstraint.hxx>
29 #include <Plate_SequenceOfLinearScalarConstraint.hxx>
30 #include <Standard_Real.hxx>
31 #include <TColgp_HArray2OfXYZ.hxx>
32 #include <TColgp_SequenceOfXY.hxx>
33 #include <Message_ProgressScope.hxx>
34 
35 class Plate_PinpointConstraint;
36 class Plate_LinearXYZConstraint;
37 class Plate_LinearScalarConstraint;
38 class Plate_GlobalTranslationConstraint;
39 class Plate_LineConstraint;
40 class Plate_PlaneConstraint;
41 class Plate_SampledCurveConstraint;
42 class Plate_GtoCConstraint;
43 class Plate_FreeGtoCConstraint;
44 class gp_XYZ;
45 class gp_XY;
46 class math_Matrix;
47 
48 
49 //! This class implement a variationnal spline algorithm able
50 //! to define a two variable function satisfying some constraints
51 //! and minimizing an energy like criterion.
52 class Plate_Plate
53 {
54 public:
55 
56   DEFINE_STANDARD_ALLOC
57 
58 
59   Standard_EXPORT Plate_Plate();
60 
61   Standard_EXPORT Plate_Plate(const Plate_Plate& Ref);
62 
63   Standard_EXPORT Plate_Plate& Copy (const Plate_Plate& Ref);
operator =(const Plate_Plate & Ref)64 Plate_Plate& operator= (const Plate_Plate& Ref)
65 {
66   return Copy(Ref);
67 }
68 
69   Standard_EXPORT void Load (const Plate_PinpointConstraint& PConst);
70 
71   Standard_EXPORT void Load (const Plate_LinearXYZConstraint& LXYZConst);
72 
73   Standard_EXPORT void Load (const Plate_LinearScalarConstraint& LScalarConst);
74 
75   Standard_EXPORT void Load (const Plate_GlobalTranslationConstraint& GTConst);
76 
77   Standard_EXPORT void Load (const Plate_LineConstraint& LConst);
78 
79   Standard_EXPORT void Load (const Plate_PlaneConstraint& PConst);
80 
81   Standard_EXPORT void Load (const Plate_SampledCurveConstraint& SCConst);
82 
83   Standard_EXPORT void Load (const Plate_GtoCConstraint& GtoCConst);
84 
85   Standard_EXPORT void Load (const Plate_FreeGtoCConstraint& FGtoCConst);
86 
87   Standard_EXPORT void SolveTI (const Standard_Integer ord = 4,
88                                 const Standard_Real anisotropie = 1.0,
89                                 const Message_ProgressRange& theProgress = Message_ProgressRange());
90 
91   //! returns True if all has been correctly done.
92   Standard_EXPORT Standard_Boolean IsDone() const;
93 
94   Standard_EXPORT void destroy();
~Plate_Plate()95 ~Plate_Plate()
96 {
97   destroy();
98 }
99 
100   //! reset the Plate in the initial state
101   //! ( same as after Create())
102   Standard_EXPORT void Init();
103 
104   Standard_EXPORT gp_XYZ Evaluate (const gp_XY& point2d) const;
105 
106   Standard_EXPORT gp_XYZ EvaluateDerivative (const gp_XY& point2d, const Standard_Integer iu, const Standard_Integer iv) const;
107 
108   Standard_EXPORT void CoefPol (Handle(TColgp_HArray2OfXYZ)& Coefs) const;
109 
110   Standard_EXPORT void SetPolynomialPartOnly (const Standard_Boolean PPOnly = Standard_True);
111 
112   Standard_EXPORT Standard_Integer Continuity() const;
113 
114   Standard_EXPORT void UVBox (Standard_Real& UMin, Standard_Real& UMax, Standard_Real& VMin, Standard_Real& VMax) const;
115 
116   Standard_EXPORT void UVConstraints (TColgp_SequenceOfXY& Seq) const;
117 
118 
119 
120 
121 protected:
122 
123 
124 
125 
126 
127 private:
128 
129 
130   Standard_EXPORT Standard_Real SolEm (const gp_XY& point2d, const Standard_Integer iu, const Standard_Integer iv) const;
131 
132     Standard_Real Polm (const gp_XY& point2d, const Standard_Integer iu, const Standard_Integer iv, const Standard_Integer idu, const Standard_Integer idv) const;
133 
134     Standard_Integer& Deru (const Standard_Integer index) const;
135 
136     Standard_Integer& Derv (const Standard_Integer index) const;
137 
138     gp_XYZ& Solution (const Standard_Integer index) const;
139 
140     gp_XY& Points (const Standard_Integer index) const;
141 
142   Standard_EXPORT void SolveTI1 (const Standard_Integer IterationNumber,
143                                  const Message_ProgressRange& theProgress = Message_ProgressRange());
144 
145   Standard_EXPORT void SolveTI2 (const Standard_Integer IterationNumber,
146                                  const Message_ProgressRange& theProgress = Message_ProgressRange());
147 
148   Standard_EXPORT void SolveTI3 (const Standard_Integer IterationNumber,
149                                  const Message_ProgressRange& theProgress = Message_ProgressRange());
150 
151   Standard_EXPORT void fillXYZmatrix (math_Matrix& mat, const Standard_Integer i0, const Standard_Integer j0, const Standard_Integer ncc1, const Standard_Integer ncc2) const;
152 
153 
154   Standard_Integer order;
155   Standard_Integer n_el;
156   Standard_Integer n_dim;
157   Standard_Address solution;
158   Standard_Address points;
159   Standard_Address deru;
160   Standard_Address derv;
161   Standard_Boolean OK;
162   Plate_SequenceOfPinpointConstraint myConstraints;
163   Plate_SequenceOfLinearXYZConstraint myLXYZConstraints;
164   Plate_SequenceOfLinearScalarConstraint myLScalarConstraints;
165   Standard_Real ddu[10];
166   Standard_Real ddv[10];
167   Standard_Integer maxConstraintOrder;
168   Standard_Boolean PolynomialPartOnly;
169   Standard_Real Uold;
170   Standard_Real Vold;
171   Standard_Real U2;
172   Standard_Real R;
173   Standard_Real L;
174 
175 
176 };
177 
178 
179 #include <Plate_Plate.lxx>
180 
181 
182 
183 
184 
185 #endif // _Plate_Plate_HeaderFile
186