Forbear
Fortran (progress) B(e)ar envinronment
Install / Use
/learn @szaghi/ForbearREADME
<a name="top"></a>
forbear

forbear, Fortran (progress) B(~~e~~)ar environment
forbear has
emute, pronce it likeforbar.
A KISS pure Fortran Library for building and running fancy progress bar

- forbear is a pure Fortran (KISS) library for building and running fancy progress bar for modern Fortran projects;
- forbear is Fortran 2008+ standard compliant;
- forbear is OOP designed;
- forbear is TDD developed;
- forbear is a Free, Open Source Project.
Issues
Compiler Support
| What is forbear? | Main features | Copyrights | Documentation | Install |
What is forbear?
In Executing long-time running programs it could be helpful to display a progress bar with some informative data. forbear is designed to perform just this task, handle the progress and display it as the user specifications:
forbear handles data related to the progress of a (long) time run giving an informative, pretty-formatted ouput for each time step (or accordingly a given frequency) as the user specifications.
Go to Top
Main features
- [x] Bar Element-Based Structure:
- fully customizable elements:
- foreground color;
- background color;
- style;
- fully customizable elements:
- [x] Bar
- [x] Bar scale
- [x] Progress Percentage
- [x] Progress Speed
- [x] Start-End Time
- [ ] ETA
- [ ] Adaptive ETA
- [ ] Reverse Bar
- [x] Spinners
- [x] Static Prefix-Suffix Messages
- [ ] Dynamic Message
- [x] Well Documented
- [x] Test Driven Developed
- [x] FOSS
Any feature request is welcome.
Go to Top
Copyrights
forbear is a Free and Open Source Software (FOSS), it is distributed under a very permissive multi-licensing system: selectable licenses are GPLv3, BSD2-Clause, BSD3-Clause and MIT, feel free to select the license that best matches your workflow.
Anyone is interest to use, to develop or to contribute to FORESEER is welcome.
More details can be found on wiki.
Go to Top
Documentation
Besides this README file the forbear documentation is contained into its own wiki. Detailed documentation of the API is contained into the GitHub Pages that can also be created locally by means of ford tool.
| A taster of forber | API documentation
A Taste of forbear
A minimal plate:
program forbear_minimal
!< **forbear** test.
use, intrinsic :: iso_fortran_env, only : I4P=>int32, R8P=>real64
use forbear, only : bar_object
implicit none
type(bar_object) :: bar
real(R8P) :: x
real(R8P) :: y
integer(I4P) :: i
integer(I4P) :: j
x = 0._R8P
call bar%initialize(filled_char_string='+', prefix_string='progress |', suffix_string='| ', add_progress_percent=.true.)
call bar%start
do i=1, 20
x = x + 0.05_R8P
do j=1, 100000000
y = sqrt(x) ! just spend some times
enddo
call bar%update(current=x)
enddo
endprogram forbear_minimal
That built and run provides:
→ ./forbear_minimal
progress |++++++++++++++++++++++++++++ | 85%
Go to Top
API documentation
forbear library exposes only one class, namely the bar_object class, that is used to handle the progress of your runs. The bar_object class has the following public methods
destroy method
Signature
pure subroutine destroy(self)
It has not dummy arguments (except the bar_object self bound-passed). It destroys the bar, namely reset it to the minimal (safe) status.
Examples
use forbear
type(bar_obejct) :: bar
call bar%destroy
initialize method
Signature
subroutine initialize(self, &
prefix_string, prefix_color_fg, prefix_color_bg, prefix_style, &
suffix_string, suffix_color_fg, suffix_color_bg, suffix_style, &
bracket_left_string, bracket_left_color_fg, bracket_left_color_bg, bracket_left_style, &
bracket_right_string, bracket_right_color_fg, bracket_right_color_bg, bracket_right_style, &
empty_char_string, empty_char_color_fg, empty_char_color_bg, empty_char_style, &
filled_char_string, filled_char_color_fg, filled_char_color_bg, filled_char_style, &
add_scale_bar, scale_bar_color_fg, scale_bar_color_bg, scale_bar_style, &
add_progress_percent, progress_percent_color_fg, progress_percent_color_bg, progress_percent_style, &
add_progress_speed, progress_speed_color_fg, progress_speed_color_bg, progress_speed_style, &
add_date_time, date_time_color_fg, date_time_color_bg, date_time_style, &
width, min_value, max_value, frequency)
This method initializes the bar accordingly to the user specifications. It has a huge list of dummy arguments because the bar is fully customizable. The meaning of the arguments (except the obvious passed self) are:
character(len=*), intent(in), optional :: prefix_string ! Prefix string.
character(len=*), intent(in), optional :: prefix_color_fg ! Prefix foreground color.
character(len=*), intent(in), optional :: prefix_color_bg ! Prefix background color.
character(len=*), intent(in), optional :: prefix_style ! Prefix style.
character(len=*), intent(in), optional :: suffix_string ! Suffix string.
character(len=*), intent(in), optional :: suffix_color_fg ! Suffix foreground color.
character(len=*), intent(in), optional :: suffix_color_bg ! Suffix background color.
character(len=*), intent(in), optional :: suffix_style ! Suffix style.
character(len=*), intent(in), optional :: bracket_left_string ! Left bracket string.
character(len=*), intent(in), optional :: bracket_left_color_fg ! Left bracket foreground color.
character(len=*), intent(in), optional :: bracket_left_color_bg ! Left bracket background color.
character(len=*), intent(in), optional :: bracket_left_style ! Left bracket style.
character(len=*), intent(in), optional :: bracket_right_string ! Right bracket string
character(len=*), intent(in), optional :: bracket_right_color_fg ! Right bracket foreground color.
character(len=*), intent(in), optional :: bracket_right_color_bg ! Right bracket background color.
character(len=*), intent(in), optional :: bracket_right_style ! Right bracket style.
character(len=1), intent(in), optional :: empty_char_string ! Empty char.
character(len=*), intent(in), optional :: empty_char_color_fg ! Empty char foreground color.
character(len=*), intent(in), optional :: empty_char_color_bg ! Empty char background color.
character(len=*), intent(in), optional :: empty_char_style ! Empty char style.
character(len=1), intent(in), optional :: filled_char_string ! Filled char.
character(len=*), intent(in), optional :: filled_char_color_fg ! Filled char foreground color.
character(len=*), intent(in), optional :: filled_char_color_bg ! Filled char background color.
character(len=*), intent(in), optional :: fill



