This repository was archived by the owner on Aug 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed more bugs and inconsistencites with the progress bar
- Loading branch information
Showing
11 changed files
with
1,580 additions
and
125 deletions.
There are no files selected for viewing
1,434 changes: 1,418 additions & 16 deletions
1,434
examples/Basic_Simulation/initial_conditions.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import swiftest | ||
sim = swiftest.Simulation() | ||
sim.run(tstop=20.0) | ||
sim = swiftest.Simulation(read_param=True) | ||
sim.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
! VERSION Swiftest input file | ||
T0 0.0 | ||
TSTART 0.0 | ||
TSTOP 1000.0 | ||
DT 0.005 | ||
ISTEP_OUT 200 | ||
ISTEP_DUMP 200 | ||
NC_IN init_cond.nc | ||
IN_TYPE NETCDF_DOUBLE | ||
IN_FORM EL | ||
BIN_OUT bin.nc | ||
OUT_FORM XVEL | ||
OUT_TYPE NETCDF_DOUBLE | ||
OUT_STAT REPLACE | ||
CHK_QMIN 0.004650467260962157 | ||
CHK_RMIN 0.004650467260962157 | ||
CHK_RMAX 10000.0 | ||
CHK_EJECT 10000.0 | ||
CHK_QMIN_COORD HELIO | ||
CHK_QMIN_RANGE 0.004650467260962157 10000.0 | ||
MU2KG 1.988409870698051e+30 | ||
TU2S 31557600.0 | ||
DU2M 149597870700.0 | ||
GMTINY 9.869231602224408e-07 | ||
FRAGMENTATION YES | ||
MIN_GMFRAG 9.869231602224408e-10 | ||
RESTART NO | ||
CHK_CLOSE YES | ||
GR YES | ||
ROTATION YES | ||
ENERGY NO | ||
EXTRA_FORCE NO | ||
BIG_DISCARD NO | ||
RHILL_PRESENT NO | ||
INTERACTION_LOOPS TRIANGULAR | ||
ENCOUNTER_CHECK TRIANGULAR | ||
TIDES NO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
module io_progress_bar | ||
!! author: The Purdue Swiftest Team - David A. Minton, Carlisle A. Wishard, Jennifer L.L. Pouplin, and Jacob R. Elliott | ||
!! | ||
!! Definition of classes and methods used to determine close encounters | ||
use swiftest_globals | ||
use swiftest_classes | ||
implicit none | ||
public | ||
|
||
type :: progress_bar | ||
!! author: David A. Minton | ||
!! | ||
!! Implements a class for a simple progress bar that can print on the screen. | ||
integer(I4B) :: PBARSIZE = 80 !! Number of characters acros for a whole progress bar | ||
integer(I8B) :: nloops !! The total number of loops that the progrees bar is executing | ||
character(len=:), allocatable :: barstr !! The string that prints out as the progress bar | ||
integer(I4B) :: spinner !! Position of the "spinner" that indicates that progress is being made | ||
character(len=1) :: barchar = "=" !! The progress bar character | ||
character(len=32) :: fmt !! The format string that is used to define the progress bar itself | ||
integer(I4B) :: pos !! The current position of the progress bar | ||
character(len=32) :: message !! The current message displayed at the end of the progress bar | ||
contains | ||
procedure :: reset => io_pbar_reset !! Resets the progress bar to the beginning | ||
procedure :: update => io_pbar_update !! Updates the progress bar with new values and causes the "spinner" to flip. | ||
end type progress_bar | ||
|
||
contains | ||
|
||
subroutine io_pbar_reset(self, nloops) | ||
!! author: David A. Minton | ||
!! | ||
!! Resets the progress bar to the beginning | ||
implicit none | ||
! Arguments | ||
class(progress_bar),intent(inout) :: self | ||
integer(I8B), intent(in) :: nloops | ||
! Internals | ||
character(len=2) :: numchar,numchar2 | ||
character(len=32) :: startfmt | ||
character(len=self%PBARSIZE) :: empty | ||
integer(I4B) :: k | ||
|
||
if (.not.allocated(self%barstr)) then | ||
allocate(character(self%PBARSIZE) :: self%barstr) | ||
end if | ||
do k = 1, self%PBARSIZE | ||
self%barstr(k:k) = " " | ||
end do | ||
write(numchar,'(I2)') self%PBARSIZE | ||
self%fmt = '(A1,"[",A' // numchar // ',"]",$)' | ||
self%nloops = nloops | ||
self%spinner = 0 | ||
self%pos = 0 | ||
self%message = "" | ||
|
||
write(*,fmt=self%fmt) char(13),empty | ||
|
||
return | ||
end subroutine io_pbar_reset | ||
|
||
|
||
subroutine io_pbar_update(self,i,message) | ||
!! author: David A. Minton | ||
!! | ||
!! Updates the progress bar with new values and causes the "spinner" to flip. | ||
implicit none | ||
! Arguments | ||
class(progress_bar), intent(inout) :: self !! Progres bar object | ||
integer(I8B), intent(in) :: i !! The current loop index of the progress loop | ||
character(len=*), intent(in), optional :: message !! An optional message to display to the right of the progress bar | ||
! Internals | ||
real(DP) :: frac | ||
integer(I4B) :: pos !! The current integer position of the progress bar | ||
|
||
! Compute the current position | ||
frac = real(i,kind=DP) / real(self%nloops,kind=DP) | ||
pos = min(int(ceiling(frac * self%PBARSIZE),kind=I4B),self%PBARSIZE) | ||
if (pos /= self%pos) then | ||
self%pos = pos | ||
|
||
! Fill in the bar character up to the current position | ||
self%barstr(pos:pos) = self%barchar | ||
end if | ||
|
||
self%spinner = self%spinner + 1 | ||
if (self%spinner > 4) self%spinner = 1 | ||
select case(self%spinner) | ||
case(1) | ||
self%barstr(pos+1:pos+1) = "/" | ||
case(2) | ||
self%barstr(pos+1:pos+1) = "-" | ||
case(3) | ||
self%barstr(pos+1:pos+1) = "\" | ||
case(4) | ||
self%barstr(pos+1:pos+1) = "|" | ||
end select | ||
|
||
write(*,fmt=self%fmt) char(13),self%barstr | ||
|
||
|
||
return | ||
end subroutine io_pbar_update | ||
|
||
|
||
end module io_progress_bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters