File indexing completed on 2026-10-04 09:13:32
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef _AppDef_Variational_HeaderFile
0018 #define _AppDef_Variational_HeaderFile
0019
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023
0024 #include <AppDef_MultiLine.hxx>
0025 #include <Standard_Integer.hxx>
0026 #include <AppParCurves_ConstraintCouple.hxx>
0027 #include <NCollection_Array1.hxx>
0028 #include <NCollection_HArray1.hxx>
0029 #include <GeomAbs_Shape.hxx>
0030 #include <AppParCurves_MultiBSpCurve.hxx>
0031 #include <Standard_OStream.hxx>
0032 #include <math_Vector.hxx>
0033 #include <AppParCurves_Constraint.hxx>
0034 #include <PLib_HermitJacobi.hxx>
0035 class AppDef_SmoothCriterion;
0036 class math_Matrix;
0037 class FEmTool_Curve;
0038 class FEmTool_Assembly;
0039
0040
0041
0042
0043
0044
0045 class AppDef_Variational
0046 {
0047 public:
0048 DEFINE_STANDARD_ALLOC
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062 Standard_EXPORT AppDef_Variational(
0063 const AppDef_MultiLine& SSP,
0064 const int FirstPoint,
0065 const int LastPoint,
0066 const occ::handle<NCollection_HArray1<AppParCurves_ConstraintCouple>>& TheConstraints,
0067 const int MaxDegree = 14,
0068 const int MaxSegment = 100,
0069 const GeomAbs_Shape Continuity = GeomAbs_C2,
0070 const bool WithMinMax = false,
0071 const bool WithCutting = true,
0072 const double Tolerance = 1.0,
0073 const int NbIterations = 2);
0074
0075
0076 Standard_EXPORT void Approximate();
0077
0078
0079
0080 Standard_EXPORT bool IsCreated() const;
0081
0082
0083
0084 Standard_EXPORT bool IsDone() const;
0085
0086
0087
0088 Standard_EXPORT bool IsOverConstrained() const;
0089
0090
0091
0092 Standard_EXPORT AppParCurves_MultiBSpCurve Value() const;
0093
0094
0095
0096
0097 Standard_EXPORT double MaxError() const;
0098
0099
0100 Standard_EXPORT int MaxErrorIndex() const;
0101
0102
0103
0104
0105 Standard_EXPORT double QuadraticError() const;
0106
0107
0108
0109 Standard_EXPORT void Distance(math_Matrix& mat);
0110
0111
0112
0113 Standard_EXPORT double AverageError() const;
0114
0115
0116 Standard_EXPORT const occ::handle<NCollection_HArray1<double>>& Parameters() const;
0117
0118
0119 Standard_EXPORT const occ::handle<NCollection_HArray1<double>>& Knots() const;
0120
0121
0122 Standard_EXPORT void Criterium(double& VFirstOrder,
0123 double& VSecondOrder,
0124 double& VThirdOrder) const;
0125
0126
0127
0128 Standard_EXPORT void CriteriumWeight(double& Percent1, double& Percent2, double& Percent3) const;
0129
0130
0131 Standard_EXPORT int MaxDegree() const;
0132
0133
0134 Standard_EXPORT int MaxSegment() const;
0135
0136
0137 Standard_EXPORT GeomAbs_Shape Continuity() const;
0138
0139
0140
0141 Standard_EXPORT bool WithMinMax() const;
0142
0143
0144 Standard_EXPORT bool WithCutting() const;
0145
0146
0147 Standard_EXPORT double Tolerance() const;
0148
0149
0150 Standard_EXPORT int NbIterations() const;
0151
0152
0153
0154
0155
0156 Standard_EXPORT void Dump(Standard_OStream& o) const;
0157
0158
0159
0160
0161 Standard_EXPORT bool SetConstraints(
0162 const occ::handle<NCollection_HArray1<AppParCurves_ConstraintCouple>>& aConstrainst);
0163
0164
0165 Standard_EXPORT void SetParameters(const occ::handle<NCollection_HArray1<double>>& param);
0166
0167
0168
0169
0170 Standard_EXPORT bool SetKnots(const occ::handle<NCollection_HArray1<double>>& knots);
0171
0172
0173
0174
0175 Standard_EXPORT bool SetMaxDegree(const int Degree);
0176
0177
0178
0179
0180 Standard_EXPORT bool SetMaxSegment(const int NbSegment);
0181
0182
0183
0184
0185 Standard_EXPORT bool SetContinuity(const GeomAbs_Shape C);
0186
0187
0188
0189 Standard_EXPORT void SetWithMinMax(const bool MinMax);
0190
0191
0192
0193
0194 Standard_EXPORT bool SetWithCutting(const bool Cutting);
0195
0196
0197
0198
0199
0200 Standard_EXPORT void SetCriteriumWeight(const double Percent1,
0201 const double Percent2,
0202 const double Percent3);
0203
0204
0205
0206
0207
0208
0209 Standard_EXPORT void SetCriteriumWeight(const int Order, const double Percent);
0210
0211
0212 Standard_EXPORT void SetTolerance(const double Tol);
0213
0214
0215
0216 Standard_EXPORT void SetNbIterations(const int Iter);
0217
0218 private:
0219 Standard_EXPORT void TheMotor(occ::handle<AppDef_SmoothCriterion>& J,
0220 const double WQuadratic,
0221 const double WQuality,
0222 occ::handle<FEmTool_Curve>& TheCurve,
0223 NCollection_Array1<double>& Ecarts);
0224
0225 Standard_EXPORT void Adjusting(occ::handle<AppDef_SmoothCriterion>& J,
0226 double& WQuadratic,
0227 double& WQuality,
0228 occ::handle<FEmTool_Curve>& TheCurve,
0229 NCollection_Array1<double>& Ecarts);
0230
0231 Standard_EXPORT void Optimization(occ::handle<AppDef_SmoothCriterion>& J,
0232 FEmTool_Assembly& A,
0233 const bool ToAssemble,
0234 const double EpsDeg,
0235 occ::handle<FEmTool_Curve>& Curve,
0236 const NCollection_Array1<double>& Parameters) const;
0237
0238 Standard_EXPORT void Project(const occ::handle<FEmTool_Curve>& C,
0239 const NCollection_Array1<double>& Ti,
0240 NCollection_Array1<double>& ProjTi,
0241 NCollection_Array1<double>& Distance,
0242 int& NumPoints,
0243 double& MaxErr,
0244 double& QuaErr,
0245 double& AveErr,
0246 const int NbIterations = 2) const;
0247
0248 Standard_EXPORT void ACR(occ::handle<FEmTool_Curve>& Curve,
0249 NCollection_Array1<double>& Ti,
0250 const int Decima) const;
0251
0252 Standard_EXPORT void SplitCurve(const occ::handle<FEmTool_Curve>& InCurve,
0253 const NCollection_Array1<double>& Ti,
0254 const double CurveTol,
0255 occ::handle<FEmTool_Curve>& OutCurve,
0256 bool& iscut) const;
0257
0258 Standard_EXPORT void Init();
0259
0260 Standard_EXPORT void InitSmoothCriterion();
0261
0262 Standard_EXPORT void InitParameters(double& Length);
0263
0264 Standard_EXPORT void InitCriterionEstimations(const double Length,
0265 double& J1,
0266 double& J2,
0267 double& J3) const;
0268
0269 Standard_EXPORT void EstTangent(const int ipnt, math_Vector& VTang) const;
0270
0271 Standard_EXPORT void EstSecnd(const int ipnt,
0272 const math_Vector& VTang1,
0273 const math_Vector& VTang2,
0274 const double Length,
0275 math_Vector& VScnd) const;
0276
0277 Standard_EXPORT void InitCutting(const PLib_HermitJacobi& aBase,
0278 const double CurvTol,
0279 occ::handle<FEmTool_Curve>& aCurve) const;
0280
0281 Standard_EXPORT void AssemblingConstraints(const occ::handle<FEmTool_Curve>& Curve,
0282 const NCollection_Array1<double>& Parameters,
0283 const double CBLONG,
0284 FEmTool_Assembly& A) const;
0285
0286 Standard_EXPORT bool InitTthetaF(const int ndimen,
0287 const AppParCurves_Constraint typcon,
0288 const int begin,
0289 const int jndex);
0290
0291 AppDef_MultiLine mySSP;
0292 int myNbP3d;
0293 int myNbP2d;
0294 int myDimension;
0295 int myFirstPoint;
0296 int myLastPoint;
0297 int myNbPoints;
0298 occ::handle<NCollection_HArray1<double>> myTabPoints;
0299 occ::handle<NCollection_HArray1<AppParCurves_ConstraintCouple>> myConstraints;
0300 int myNbConstraints;
0301 occ::handle<NCollection_HArray1<double>> myTabConstraints;
0302 int myNbPassPoints;
0303 int myNbTangPoints;
0304 int myNbCurvPoints;
0305 occ::handle<NCollection_HArray1<int>> myTypConstraints;
0306 occ::handle<NCollection_HArray1<double>> myTtheta;
0307 occ::handle<NCollection_HArray1<double>> myTfthet;
0308 int myMaxDegree;
0309 int myMaxSegment;
0310 int myNbIterations;
0311 double myTolerance;
0312 GeomAbs_Shape myContinuity;
0313 int myNivCont;
0314 bool myWithMinMax;
0315 bool myWithCutting;
0316 double myPercent[3];
0317 double myCriterium[4];
0318 occ::handle<AppDef_SmoothCriterion> mySmoothCriterion;
0319 occ::handle<NCollection_HArray1<double>> myParameters;
0320 occ::handle<NCollection_HArray1<double>> myKnots;
0321 AppParCurves_MultiBSpCurve myMBSpCurve;
0322 double myMaxError;
0323 int myMaxErrorIndex;
0324 double myAverageError;
0325 bool myIsCreated;
0326 bool myIsDone;
0327 bool myIsOverConstr;
0328 };
0329
0330 #endif