mask_not Function

public function mask_not(mask) result(result_mask)

Logical NOT operation on a mask

@param[in] mask Boolean mask to negate @return result_mask Negated mask

Arguments

Type IntentOptional Attributes Name
type(boolean_mask), intent(in) :: mask

Return Value type(boolean_mask)


Source Code

    function mask_not(mask) result(result_mask)
        type(boolean_mask), intent(in) :: mask
        type(boolean_mask) :: result_mask

        logical, dimension(:), allocatable :: arr, negated
        integer :: i

        arr = mask % get_mask()
        allocate (negated(size(arr)))

        do i = 1, size(arr)
            negated(i) = .not. arr(i)
        end do

        call result_mask % new(negated)
        deallocate (arr, negated)
    end function mask_not