Skip to main content

AbstractFunction

To handle analytical functions following abstract functions have been defined in EASIFEM.

  • AbstractFunction_ all functions are children of this.
  • AbstractFunction1D_ abstract function in one variable
  • AbstractFunction2D_ abstract function of two variables
  • AbstractFunction3D_ abstract function of three variables
  • AbstractFunctionND_ abstract function of N variables

Structure​

TYPE, ABSTRACT :: AbstractFunction_
CONTAINS
PROCEDURE, PUBLIC, PASS(Obj) :: Deallocate => func_Deallocate
END TYPE AbstractFunction_
TYPE, ABSTRACT :: AbstractFunction_
CONTAINS
PROCEDURE, PUBLIC, PASS(Obj) :: Deallocate => func_Deallocate
END TYPE AbstractFunction_
note

Following classes are children of Abstract1D_

Methods​

AbstractFunctions are equipied with following methdods:

  • Deallocate() To deallocate/ destroy the instance/variable.
  • Eval Evaluate the function
  • EvalGradient Evaluate the first gradient.
  • GetVarName return the name of agrumnets of the function.

Eval​

Eval method evaluates the function. For AbstractFunction1D,2D,3D it is an ELEMENTAL function. In case of AbstractFunctionND it is only PURE.

Eval method for AbstractFunction1D_

ABSTRACT INTERFACE
RECURSIVE PURE FUNCTION Eval(obj, x) RESULT(ans)
IMPORT AbstractFunction1D_, DFP
CLASS(AbstractFunction1D_), INTENT(IN) :: obj
REAL(DFP), INTENT(IN) :: x
REAL(DFP) :: ans
END FUNCTION Eval
END INTERFACE

EvalGradient​

EvalGradient computes the first derivative of the function at given argument.

ABSTRACT INTERFACE
RECURSIVE PURE FUNCTION EvalGradient(obj, x) RESULT(ans)
IMPORT AbstractFunction1D_, DFP
CLASS(AbstractFunction1D_), INTENT(IN) :: obj
REAL(DFP), INTENT(IN) :: x
REAL(DFP) :: ans
END FUNCTION EvalGradient
END INTERFACE
info

EvalGradient method for AbstractFunction1D_

GetVarName​

GetVarName returns the variable name as an instance of String.