37 real(dp),
dimension(:, :),
allocatable :: cached_gradients
57 cached_gradient%dis => dis
59 call move_alloc(gradient, cached_gradient%gradient)
60 allocate (cached_gradient%cached_gradients(dis%nodes, 3))
68 deallocate (this%cached_gradients)
71 function get(this, n)
result(grad_c)
74 integer(I4B),
intent(in) :: n
76 real(dp),
dimension(3) :: grad_c
78 grad_c = this%cached_gradients(n, :)
84 real(DP),
dimension(:),
pointer,
intent(in) :: phi
88 call this%gradient%set_field(phi)
89 do n = 1, this%dis%nodes
90 this%cached_gradients(n, :) = this%gradient%get(n)
subroutine set_field(this, phi)
type(cachedgradienttype) function constructor(gradient, dis)
subroutine destructor(this)
real(dp) function, dimension(3) get(this, n)
This module contains simulation constants.
real(dp), parameter done
real constant 1
This module defines variable data types.
Decorator that adds caching to any gradient computation implementation.
Abstract interface for cell-based gradient computation.