Assigns this object to another equation of state object, allowing the definided assignment for the precalculated density field to work correctly.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(equation_of_state), | intent(out) | :: | lhs | |||
class(prescribed_eos), | intent(in) | :: | rhs |
subroutine prescribed_assign(lhs, rhs)
!* Author: Chris MacMackin
! Date: March 2017
!
! Assigns this object to another equation of state object,
! allowing the definided assignment for the precalculated density
! field to work correctly.
!
class(equation_of_state), intent(out) :: lhs
class(prescribed_eos), intent(in) :: rhs
select type(lhs)
class is(prescribed_eos)
if (allocated(lhs%density)) then
if (.not. same_type_as(lhs%density, rhs%density)) then
deallocate(lhs%density)
allocate(lhs%density, mold=rhs%density)
end if
else
allocate(lhs%density, mold=rhs%density)
end if
lhs%density = rhs%density
class default
error stop ("Can't assign to `equation_of_state` object of class other "// &
"than `prescribed_eos`.")
end select
end subroutine prescribed_assign