LCOV - code coverage report
Current view: top level - math - differentiate.f90 (source / functions) Hit Total Coverage
Test: combined.info Lines: 12 12 100.0 %
Date: 2019-09-08 04:53:50 Functions: 2 2 100.0 %

          Line data    Source code
       1             : !--------------------------------------------------------------------------------
       2             : ! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
       3             : ! This file is part of FLEUR and available as free software under the conditions
       4             : ! of the MIT license as expressed in the LICENSE file in more detail.
       5             : !--------------------------------------------------------------------------------
       6             : 
       7             : MODULE m_differentiate
       8             : CONTAINS
       9      998620 :   REAL FUNCTION difcub(x,f,xi)
      10             :     !     **********************************************************
      11             :     !     differentiate the function f, given at the
      12             :     !     points x0,x1,x2,x3 at the point xi by lagrange
      13             :     !     interpolation for polynomial of 3rd order
      14             :     !     r.p.
      15             :     !     ***********************************************************
      16             :     IMPLICIT NONE
      17             :     !     .. Scalar Arguments ..
      18             :     REAL,INTENT(IN):: xi
      19             :     !     ..
      20             :     !     .. Array Arguments ..
      21             :     REAL,INTENT(IN):: f(0:3),x(0:3)
      22             :     !     ..
      23             :     difcub = ((xi-x(1))* (xi-x(2))+ (xi-x(1))* (xi-x(3))+&
      24             :          (xi-x(2))* (xi-x(3)))*f(0)/ ((x(0)-x(1))* (x(0)-x(2))*&
      25             :          (x(0)-x(3))) + ((xi-x(0))* (xi-x(2))+&
      26             :          (xi-x(0))* (xi-x(3))+ (xi-x(2))* (xi-x(3)))*f(1)/&
      27             :          ((x(1)-x(0))* (x(1)-x(2))* (x(1)-x(3))) +&
      28             :          ((xi-x(0))* (xi-x(1))+ (xi-x(0))* (xi-x(3))+&
      29             :          (xi-x(1))* (xi-x(3)))*f(2)/ ((x(2)-x(0))* (x(2)-x(1))*&
      30             :          (x(2)-x(3))) + ((xi-x(0))* (xi-x(1))+&
      31             :          (xi-x(0))* (xi-x(2))+ (xi-x(1))* (xi-x(2)))*f(3)/&
      32      998620 :          ((x(3)-x(0))* (x(3)-x(1))* (x(3)-x(2)))
      33             :     RETURN
      34             :   END FUNCTION difcub
      35        3344 :   SUBROUTINE diff3(&
      36        3344 :        f,dx,&
      37        3344 :        df)
      38             :     !********************************************************************
      39             :     !     differetiation via 3-points
      40             :     !********************************************************************
      41             : 
      42             :     IMPLICIT NONE
      43             : 
      44             :     !     .. Scalar Arguments ..
      45             :     REAL,    INTENT (IN) :: dx
      46             :     !     ..
      47             :     !     .. Array Arguments ..
      48             :     REAL, INTENT (IN)  ::  f(:)
      49             :     REAL, INTENT (OUT) :: df(:)
      50             :     !     ..
      51             :     !     .. Local Scalars ..
      52             :     INTEGER i,jri
      53             :     REAL tdx_i
      54             :     !     ..
      55        3344 :     jri=size(f)
      56        3344 :     tdx_i = 1./(2.*dx)
      57             :     !
      58             :     !---> first point
      59        3344 :     df(1) = -tdx_i * (-3.*f(1)+4.*f(2)-f(3))
      60             :     !
      61             :     !---> central point formula in charge
      62     1929544 :     DO i = 2,jri - 1
      63     1929544 :        df(i) = tdx_i * (f(i+1)-f(i-1))
      64             :     END DO
      65             :     !
      66             :     !---> last point
      67        3344 :     df(jri) = tdx_i * (3.*f(jri)-4.*f(jri-1)+f(jri-2))
      68             :     !
      69        3344 :     RETURN
      70             :   END SUBROUTINE diff3
      71             : 
      72             : END MODULE m_differentiate

Generated by: LCOV version 1.13