mask_constructor Subroutine

private subroutine mask_constructor(this, logical_array)

Initialize a boolean mask from a logical array

@param[in,out] this The boolean mask instance @param[in] logical_array The logical array to initialize from

Type Bound

boolean_mask

Arguments

Type IntentOptional Attributes Name
class(boolean_mask), intent(inout) :: this
logical, intent(in), dimension(:) :: logical_array

Source Code

    subroutine mask_constructor(this, logical_array)
        class(boolean_mask), intent(inout) :: this
        logical, dimension(:), intent(in) :: logical_array

        if (this % initialized) call this % destroy()

        this % size = size(logical_array)
        allocate (this % mask(this % size))
        this % mask = logical_array
        this % initialized = .true.
    end subroutine mask_constructor