File indexing completed on 2026-09-28 09:19:56
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef _Extrema_GGenExtPC_HeaderFile
0018 #define _Extrema_GGenExtPC_HeaderFile
0019
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022
0023 #include <math_FunctionRoots.hxx>
0024 #include <StdFail_NotDone.hxx>
0025 #include <Standard_OutOfRange.hxx>
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037 template <typename TheCurve, typename TheTool, typename ThePOnC, typename ThePoint, typename ThePCF>
0038 class Extrema_GGenExtPC
0039 {
0040 public:
0041 DEFINE_STANDARD_ALLOC
0042
0043
0044 Extrema_GGenExtPC()
0045 : myDone(false),
0046 myInit(false),
0047 mynbsample(0),
0048 myumin(0.0),
0049 myusup(0.0),
0050 mytolu(0.0),
0051 mytolF(0.0)
0052 {
0053 }
0054
0055
0056
0057
0058
0059
0060
0061 Extrema_GGenExtPC(const ThePoint& theP,
0062 const TheCurve& theC,
0063 const int theNbSample,
0064 const double theTolU,
0065 const double theTolF)
0066 : myF(theP, theC)
0067 {
0068 Initialize(theC, theNbSample, theTolU, theTolF);
0069 Perform(theP);
0070 }
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080 Extrema_GGenExtPC(const ThePoint& theP,
0081 const TheCurve& theC,
0082 const int theNbSample,
0083 const double theUmin,
0084 const double theUsup,
0085 const double theTolU,
0086 const double theTolF)
0087 : myF(theP, theC)
0088 {
0089 Initialize(theC, theNbSample, theUmin, theUsup, theTolU, theTolF);
0090 Perform(theP);
0091 }
0092
0093
0094
0095
0096
0097
0098 void Initialize(const TheCurve& theC,
0099 const int theNbU,
0100 const double theTolU,
0101 const double theTolF)
0102 {
0103 myInit = true;
0104 mynbsample = theNbU;
0105 mytolu = theTolU;
0106 mytolF = theTolF;
0107 myF.Initialize(theC);
0108 myumin = TheTool::FirstParameter(theC);
0109 myusup = TheTool::LastParameter(theC);
0110 }
0111
0112
0113
0114
0115
0116
0117
0118
0119 void Initialize(const TheCurve& theC,
0120 const int theNbU,
0121 const double theUmin,
0122 const double theUsup,
0123 const double theTolU,
0124 const double theTolF)
0125 {
0126 myInit = true;
0127 mynbsample = theNbU;
0128 mytolu = theTolU;
0129 mytolF = theTolF;
0130 myF.Initialize(theC);
0131 myumin = theUmin;
0132 myusup = theUsup;
0133 }
0134
0135
0136
0137
0138
0139
0140
0141 void Initialize(const int theNbU,
0142 const double theUmin,
0143 const double theUsup,
0144 const double theTolU,
0145 const double theTolF)
0146 {
0147 mynbsample = theNbU;
0148 mytolu = theTolU;
0149 mytolF = theTolF;
0150 myumin = theUmin;
0151 myusup = theUsup;
0152 }
0153
0154
0155
0156 void Initialize(const TheCurve& theC) { myF.Initialize(theC); }
0157
0158
0159
0160 void Perform(const ThePoint& theP)
0161 {
0162 myF.SetPoint(theP);
0163 myF.SubIntervalInitialize(myumin, myusup);
0164 myDone = false;
0165
0166 math_FunctionRoots S(myF, myumin, myusup, mynbsample, mytolu, mytolF, mytolF);
0167 if (!S.IsDone() || S.IsAllNull())
0168 {
0169 return;
0170 }
0171
0172 myDone = true;
0173 }
0174
0175
0176 bool IsDone() const { return myDone; }
0177
0178
0179
0180 int NbExt() const
0181 {
0182 if (!IsDone())
0183 {
0184 throw StdFail_NotDone();
0185 }
0186 return myF.NbExt();
0187 }
0188
0189
0190
0191
0192 double SquareDistance(const int theN) const
0193 {
0194 if ((theN < 1) || (theN > NbExt()))
0195 {
0196 throw Standard_OutOfRange();
0197 }
0198 return myF.SquareDistance(theN);
0199 }
0200
0201
0202
0203
0204 bool IsMin(const int theN) const
0205 {
0206 if ((theN < 1) || (theN > NbExt()))
0207 {
0208 throw Standard_OutOfRange();
0209 }
0210 return myF.IsMin(theN);
0211 }
0212
0213
0214
0215
0216 const ThePOnC& Point(const int theN) const
0217 {
0218 if ((theN < 1) || (theN > NbExt()))
0219 {
0220 throw Standard_OutOfRange();
0221 }
0222 return myF.Point(theN);
0223 }
0224
0225 private:
0226 bool myDone;
0227 bool myInit;
0228 int mynbsample;
0229 double myumin;
0230 double myusup;
0231 double mytolu;
0232 double mytolF;
0233 ThePCF myF;
0234 };
0235
0236 #endif