boolean_mask Derived Type

type, public :: boolean_mask

Boolean mask type for storing logical arrays

Used to create pandas-like boolean indexing masks that can be combined with logical operators and applied to data frames


Components

Type Visibility Attributes Name Initial
logical, private :: initialized = .false.
logical, private, dimension(:), allocatable :: mask
integer, private :: size = 0

Type-Bound Procedures

procedure, public :: destroy => mask_destructor

procedure, public :: get_mask => mask_get

  • private function mask_get(this) result(logical_array)

    Get the logical array from the mask

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(boolean_mask), intent(in) :: this

    Return Value logical, dimension(:), allocatable

procedure, public :: get_size => mask_get_size

  • private pure function mask_get_size(this) result(size)

    Get the size of the mask

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(boolean_mask), intent(in) :: this

    Return Value integer

procedure, public :: is_initialized => mask_is_initialized

procedure, public :: new => mask_constructor

  • private subroutine mask_constructor(this, logical_array)

    Initialize a boolean mask from a logical array

    Read more…

    Arguments

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

Source Code

    type :: boolean_mask
        private
        logical, dimension(:), allocatable :: mask
        integer :: size = 0
        logical :: initialized = .false.
    contains
        private
        procedure, public :: new => mask_constructor
        procedure, public :: destroy => mask_destructor
        procedure, public :: get_mask => mask_get
        procedure, public :: get_size => mask_get_size
        procedure, public :: is_initialized => mask_is_initialized
    end type boolean_mask