jacobian_block_add_field Function

private function jacobian_block_add_field(this, rhs) result(sum)

Produces a Jacobian block which has been offset by a scalar field.

Arguments

Type IntentOptional AttributesName
class(jacobian_block), intent(in) :: this
class(scalar_field), intent(in) :: rhs

A scalar which should be added to this block

Return Value type(jacobian_block)


Contents


Source Code

  function jacobian_block_add_field(this, rhs) result(sum)
    !* Author: Chris MacMackin 
    !  Date: May 2017
    !
    ! Produces a Jacobian block which has been offset by a scalar
    ! field.
    !
    ! @Warning This operation will overwrite any previous sums which
    ! have been performed to produce `this`.
    !
    class(jacobian_block), intent(in) :: this
    class(scalar_field), intent(in)   :: rhs
      !! A scalar which should be added to this block
    type(jacobian_block)              :: sum
    sum = this
    allocate(sum%field_increment, mold=rhs)
    sum%field_increment = rhs
    sum%has_increment = sum%has_increment + 2
#ifdef DEBUG
    call logger%debug('jacobian_block%add','Added field to a Jacobian block.')
#endif
  end function jacobian_block_add_field