Filter the array of colormaps based on the given criteria and write information about the filtered colormaps
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(Colormaps_info), | intent(inout) | :: | this | |||
integer, | intent(in), | optional | :: | verbose | ||
character(len=*), | intent(in), | optional | :: | name | ||
character(len=*), | intent(in), | optional | :: | family | ||
character(len=*), | intent(in), | optional | :: | gradient | ||
character(len=*), | intent(in), | optional | :: | palette | ||
character(len=*), | intent(in), | optional | :: | author | ||
character(len=*), | intent(in), | optional | :: | license | ||
integer, | intent(in), | optional | :: | levels | ||
character(len=*), | intent(in), | optional | :: | file_name |
impure subroutine write(this, verbose, name, family, gradient, palette, author, license, levels, file_name) class(Colormaps_info), intent(inout) :: this integer, intent(in), optional :: verbose character(*), intent(in), optional :: name, family, gradient, palette, author, license integer, intent(in), optional :: levels character(*), intent(in), optional :: file_name integer :: i, k, verbose_, nunit integer :: ind(this%get_ncolormaps(),8) ! 1: index, 2: name, 3: family, 4: gradient, 5: palette, 6: author, 7: license, 8: levels integer, allocatable :: inter_ind(:) ! Set default values if (present(verbose)) then verbose_ = verbose else verbose_ = 1 end if ! Print header for verbose = 1 if (verbose_ == 1) then if (present(file_name)) then open(newunit=nunit, file=trim(file_name), position='append', status='unknown', action='write') write(nunit,'(a)')'' ! Print empty line write(nunit,'(g0,8x,g0,6x,g0,12x,g0,7x,g0,1x,g0,17x,g0,20x,g0,11x,g0,28x,g0)') & '|Name', '|Family', '|Gradient', '|Palette', '|Levels', '|Colorbar', '|Package', '|Author', '|Licence', '|URL|' write(nunit,'(a)') '|---|---|---|---|---|---|---|---|---|---|' close(nunit) else print*,'' ! Print empty line print '(g0,8x,g0,6x,g0,12x,g0,7x,g0,1x,g0,17x,g0,20x,g0,11x,g0,28x,g0)', & 'Name', 'Family', 'Gradient', 'Palette', 'Levels', 'Colorbar', 'Package', 'Author', 'Licence', 'URL' print'(a)', '*****************************************************************************************& &*****************************************************************************************************& &**********************' end if end if ! Print header for verbose = 4 if (verbose_ == 4) then if (present(file_name)) then open(newunit=nunit, file=trim(file_name), position='append', status='unknown', action='write') write(nunit,'(a)')'' ! Print empty line write(nunit,'(g0,8x,g0,6x,g0,12x,g0,7x,g0,1x,g0,17x,g0,20x,g0,11x,g0,8x,g0)') & '|Name', '|Family', '|Gradient', '|Palette', '|Levels', '|Colorbar |' write(nunit,'(a)') '|------------|------------|--------------------|--------------|-------|-------------------------|' close(nunit) else print*,'' ! Print empty line print '(g0,8x,g0,6x,g0,12x,g0,7x,g0,1x,g0)', & 'Name', 'Family', 'Gradient', 'Palette', 'Levels', 'Colorbar' print'(a)', '**************************************************************************************************' end if end if if (present(name) .or.& present(family) .or.& present(gradient) .or.& present(palette) .or.& present(author) .or.& present(license) .or.& present(levels)) then ind = 0 do i = 1, this%get_ncolormaps() ind(i, 1) = i end do if (present(name)) then k = 1 do i = 1, this%get_ncolormaps() if (this%colormaps(i)%name == name) then ind(k,2) = i k = k + 1 end if end do end if if (present(family)) then k = 1 do i = 1, this%get_ncolormaps() if (this%colormaps(i)%family == family) then ind(k,3) = i k = k + 1 end if end do end if if (present(gradient)) then k = 1 do i = 1, this%get_ncolormaps() if (this%colormaps(i)%gradient == gradient) then ind(k,4) = i k = k + 1 end if end do end if if (present(palette)) then k = 1 do i = 1, this%get_ncolormaps() if (this%colormaps(i)%palette == palette) then ind(k,5) = i k = k + 1 end if end do end if if (present(author)) then k = 1 do i = 1, this%get_ncolormaps() if (this%colormaps(i)%author == author) then ind(k,6) = i k = k + 1 end if end do end if if (present(license)) then k = 1 do i = 1, this%get_ncolormaps() if (this%colormaps(i)%license == license) then ind(k,7) = i k = k + 1 end if end do end if if (present(levels)) then k = 1 do i = 1, this%get_ncolormaps() if (this%colormaps(i)%levels == levels) then ind(k,8) = i k = k + 1 end if end do end if inter_ind = findColumnIntersections(ind(:,:)) do i = 1, this%get_ncolormaps() do k = 1, size(inter_ind) if (inter_ind(k) == i) then call this%colormaps(i)%write_info(verbose,file_name) end if end do end do if (present(file_name)) then open(newunit=nunit, file=trim(file_name), position='append', status='unknown', action='write') write(nunit,'(a)')'' ! Print empty line close(nunit) else print*,'' ! Print empty line end if else do i = 1, this%get_ncolormaps() call this%colormaps(i)%write_info(verbose,file_name) end do if (present(file_name)) then open(newunit=nunit, file=trim(file_name), position='append', status='unknown', action='write') write(nunit,'(a)')'' ! Print empty line close(nunit) else print*,'' ! Print empty line end if end if end subroutine write