25 #define ROOTFIND_SUCCESS 0 33 #define ROOTFIND_SUCCESS_XCONVERGENCEONLY 1 35 #define ROOTFIND_FAILEDCONVERGENCE -1 37 #define ROOTFIND_BADINPUT -2 39 #define ROOTFIND_SOLNLOWERTHANXMIN -3 41 #define ROOTFIND_SOLNHIGHERTHANXMAX -4 193 bool theSame(doublereal x2, doublereal x1, doublereal factor = 1.0)
const;
217 int solve(doublereal xmin, doublereal xmax,
int itmax, doublereal& funcTargetValue, doublereal* xbest);
231 doublereal
func(doublereal x);
246 void setTol(doublereal rtolf, doublereal atolf, doublereal rtolx = 0.0, doublereal atolx = 0.0);
389 double deltaXConverged;
390 double deltaFConverged;
393 std::string reasoning;
412 deltaXConverged(-1.0E300),
413 deltaFConverged(-1.0E300),
void setDeltaX(doublereal deltaXNorm)
Set the minimum value of deltaX.
doublereal DeltaXnorm_
Delta X norm.
doublereal fx_minTried_
Internal variable tracking f(x) of smallest x tried.
bool FuncIsGenerallyDecreasing_
Boolean indicating whether the function is decreasing with x.
doublereal x_maxTried_
Internal variable tracking largest x tried.
std::vector< struct rfTable > rfHistory_
Vector of iteration histories.
void setFuncIsGenerallyDecreasing(bool value)
Set the function behavior flag.
Structure containing the iteration history.
int specifiedDeltaXnorm_
Boolean indicating whether DeltaXnorm_ has been specified by the user or not.
RootFind & operator=(const RootFind &right)
void printTable()
Print the iteration history table.
doublereal delXNonzero(doublereal x1) const
Calculate a deltaX from an input value of x.
doublereal m_atolx
Absolute tolerance for the value of x.
doublereal m_rtolx
Relative tolerance for the value of x.
bool writeLogAllowed_
Boolean to turn on the possibility of writing a log file.
doublereal m_rtolf
Relative tolerance for the value of f and x.
doublereal DeltaXMax_
Delta X Max.
doublereal x_minTried_
Internal variable tracking smallest x tried.
void setTol(doublereal rtolf, doublereal atolf, doublereal rtolx=0.0, doublereal atolx=0.0)
Set the tolerance parameters for the rootfinder.
Root finder for 1D problems.
void setFuncIsGenerallyIncreasing(bool value)
Set the function behavior flag.
Virtual base class for DAE residual function evaluators.
doublereal m_funcTargetValue
Target value for the function.
bool FuncIsGenerallyIncreasing_
Boolean indicating whether the function is an increasing with x.
bool theSame(doublereal x2, doublereal x1, doublereal factor=1.0) const
Function to decide whether two real numbers are the same or not.
doublereal fx_maxTried_
Internal variable tracking f(x) of largest x tried.
doublereal delXMeaningful(doublereal x1) const
Calculate a deltaX from an input value of x.
doublereal deltaXControlled(doublereal x2, doublereal x1) const
Calculate a controlled, nonzero delta between two numbers.
ResidEval * m_residFunc
Pointer to the residual function evaluator.
int solve(doublereal xmin, doublereal xmax, int itmax, doublereal &funcTargetValue, doublereal *xbest)
Using a line search method, find the root of a 1D function.
void setDeltaXMax(doublereal deltaX)
Set the maximum value of deltaX.
doublereal m_maxstep
Maximum number of step sizes.
doublereal deltaXConverged_
Value of delta X that is needed for convergence.
RootFind(ResidEval *resid)
Constructor for the object.
void setPrintLvl(int printLvl)
Set the print level from the rootfinder.
Namespace for the Cantera kernel.
doublereal m_atolf
Absolute tolerance for the value of f.
int specifiedDeltaXMax_
Boolean indicating whether DeltaXMax_ has been specified by the user or not.
doublereal func(doublereal x)
Return the function value.