fcn1var_helper Derived Type

type, public :: fcn1var_helper

Defines a type capable of encapsulating an equation of one variable of the form: f(x) = 0.


Contents


Type-Bound Procedures

procedure, public :: diff => f1h_diff_fcn

  • private function f1h_diff_fcn(this, x, f) result(df)

    Computes the derivative of the function. If a routine for computing the derivative is not defined, the derivative is estimated via finite differences.

    Arguments

    Type IntentOptional Attributes Name
    class(fcn1var_helper), intent(in) :: this

    The fcn1var_helper object.

    real(kind=real64), intent(in) :: x

    The value of the independent variable at which the derivative is to be computed.

    real(kind=real64), intent(in), optional :: f

    An optional input specifying the function value at x. If supplied, and the derivative is being estimated numerically, the function will not be evaluated at x.

    Return Value real(kind=real64)

    The value of the derivative.

procedure, public :: fcn => f1h_fcn

  • private function f1h_fcn(this, x) result(f)

    Executes the routine containing the function to evaluate.

    Arguments

    Type IntentOptional Attributes Name
    class(fcn1var_helper), intent(in) :: this

    The fcn1var_helper object.

    real(kind=real64), intent(in) :: x

    The value of the independent variable at which the function should be evaluated.

    Return Value real(kind=real64)

    The value of the function.

procedure, public :: is_derivative_defined => f1h_is_diff_defined

  • private function f1h_is_diff_defined(this) result(x)

    Tests if the pointer to the function containing the derivative of the function to solve is defined.

    Arguments

    Type IntentOptional Attributes Name
    class(fcn1var_helper), intent(in) :: this

    The fcn1var_helper object.

    Return Value logical

    Returns true if the pointer has been assigned; else, false.

procedure, public :: is_fcn_defined => f1h_is_fcn_defined

  • private function f1h_is_fcn_defined(this) result(x)

    Tests if the pointer to the function containing the equation to solve has been assigned.

    Arguments

    Type IntentOptional Attributes Name
    class(fcn1var_helper), intent(in) :: this

    The fcn1var_helper object.

    Return Value logical

    Returns true if the pointer has been assigned; else, false.

procedure, public :: set_diff => f1h_set_diff

  • private subroutine f1h_set_diff(this, diff)

    Establishes a pointer to the routine containing the derivative of the equations to solve.

    Arguments

    Type IntentOptional Attributes Name
    class(fcn1var_helper), intent(inout) :: this

    The fcn1var_helper object.

    procedure(fcn1var), intent(in), pointer :: diff

    A pointer to the function for computing the first derivative.

procedure, public :: set_fcn => f1h_set_fcn

  • private subroutine f1h_set_fcn(this, fcn)

    Establishes a pointer to the routine containing the equations to solve.

    Arguments

    Type IntentOptional Attributes Name
    class(fcn1var_helper), intent(inout) :: this

    The fcn1var_helper object.

    procedure(fcn1var), intent(in), pointer :: fcn

    The function pointer.