get_partial_gaussian Function

function get_partial_gaussian(this, upstream_grad) result(output)

Arguments

Type IntentOptional Attributes Name
class(array_type), intent(inout) :: this
type(array_type), intent(in) :: upstream_grad

Return Value type(array_type)


Source Code

  function get_partial_gaussian(this, upstream_grad) result(output)
    implicit none
    class(array_type), intent(inout) :: this
    type(array_type), intent(in) :: upstream_grad
    type(array_type) :: output
    logical :: this_is_temporary_local
    real(real32) :: coeff
    type(array_type), pointer :: ptr1, ptr2, ptr3

    this_is_temporary_local = this%is_temporary
    this%is_temporary = .false.
    coeff = - 1._real32 / ( sqrt(2._real32 * pi ) * this%right_operand%val(2,1)**3 )

    ptr1 => this%left_operand - this%right_operand%val(1,1)
    ptr2 => -0.5_real32 * ( ptr1 / this%right_operand%val(2,1) ) ** 2
    ptr1%is_temporary = .false.
    ptr3 => upstream_grad * coeff * ptr1 * exp(ptr2)
    ptr1%is_temporary = .true.
    this%is_temporary = this_is_temporary_local
    call output%assign_and_deallocate_source(ptr3)
  end function get_partial_gaussian