MODFLOW 6  version 6.7.0.dev3
USGS Modular Hydrologic Model
IGradient.f90
Go to the documentation of this file.
1 module igradient
2  use kindmodule, only: dp, i4b
3 
4  implicit none
5  private
6 
7  public :: igradienttype
8 
9  !> @brief Abstract interface for cell-based gradient computation.
10  !!
11  !! This module defines the abstract type `IGradientType`, which provides a deferred
12  !! interface for computing the gradient of a scalar field at a given cell.
13  !! Any concrete gradient implementation must extend this type and implement the `get` method.
14  !<
15  type, abstract :: igradienttype
16  contains
17  procedure(get_if), deferred :: get
18  procedure(set_field_if), deferred :: set_field
19  end type igradienttype
20 
21  abstract interface
22 
23  function get_if(this, n) result(grad_c)
24  ! -- import
25  import igradienttype
26  import dp, i4b
27  ! -- dummy
28  class(igradienttype), target :: this
29  integer(I4B), intent(in) :: n
30  !-- return
31  real(dp), dimension(3) :: grad_c
32  end function
33 
34  subroutine set_field_if(this, phi)
35  ! -- import
36  import igradienttype
37  import dp, i4b
38  ! -- dummy
39  class(igradienttype), target :: this
40  real(DP), dimension(:), pointer, intent(in) :: phi
41  end subroutine
42 
43  end interface
44 
45 contains
46 
47 end module igradient
This module defines variable data types.
Definition: kind.f90:8
Abstract interface for cell-based gradient computation.
Definition: IGradient.f90:15