.. _program_listing_file_rootFinding_RootFinder_RootFinder.H: Program Listing for File RootFinder.H ===================================== |exhale_lsh| :ref:`Return to documentation for file ` (``rootFinding/RootFinder/RootFinder.H``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /*---------------------------------------------------------------------------* \ License This file is part of libWallModelledLES. libWallModelledLES is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. libWallModelledLES is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with libWallModelledLES. If not, see . Class Foam::RootFinder @brief Base abstract class for finding roots of non-linear algebraic equations. In the context of wall modelling the latter are provided by laws of the wall. The root finders are therefore used in conjunction with the LOTW wall model. User dictionaries select the algorithm and can set \c maxIter. The convergence tolerance is not user configurable. The current Newton, TOMS748 and Bisection implementations use the same internal binary digit target, corresponding to approximately single-precision relative accuracy in the root estimate. Contributors/Copyright: 2016-2026 Timofey Mukha 2017 Saleh Rezaeiravesh \*---------------------------------------------------------------------------*/ #ifndef RootFinder_H #define RootFinder_H #include "dictionary.H" #include "refCount.H" #include #include // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { /*---------------------------------------------------------------------------*\ Class RootFinder Declaration \*---------------------------------------------------------------------------*/ class RootFinder : public refCount { protected: //- Function defining the equation to be solved std::function f_ = [](scalar i) { return 0; }; //- Function defining the derivative of the equation to be solved std::function d_= [](scalar i) { return 0; }; //- Maximum number of iterations const label maxIter_; public: // Static data members #if !defined(DOXYGEN_SHOULD_SKIP_THIS) TypeName ("RootFinder"); #endif // Constructors RootFinder ( const word& rootFinderName, std::function f, std::function d, const label maxIter ) : refCount(), f_(f), d_(d), maxIter_(maxIter) {}; RootFinder ( std::function f, std::function d, const dictionary& dict ) : refCount(), f_(f), d_(d), maxIter_(dict.lookupOrDefault