opticalProp_t_assign Subroutine

private subroutine opticalProp_t_assign(lhs, rhs)

Type Bound

opticalProp_t

Arguments

Type IntentOptional Attributes Name
class(opticalProp_t), intent(inout) :: lhs
class(opticalProp_base), intent(in) :: rhs

Source Code

    subroutine opticalProp_t_assign(lhs, rhs)

        class(opticalProp_t),    intent(inout) :: lhs
        class(opticalProp_base), intent(in)    :: rhs

        if (allocated(lhs%value))deallocate(lhs%value)
        ! Prevent nested derived type
        select type (rhsT=>rhs)
            class is (opticalProp_t)
                if(allocated(rhsT%value))allocate(lhs%value,source=rhsT%value)
            class default
                allocate(lhs%value,source=rhsT)
        end select

    end subroutine opticalProp_t_assign