add some garbage

This commit is contained in:
tTh
2024-02-06 17:03:00 +01:00
parent ca899f5e90
commit ab23dc9897
14 changed files with 127 additions and 51 deletions

View File

@@ -31,6 +31,8 @@ module bloubspace
! ----------------------------------------------------------------
subroutine load_boundingbox(infile, where, name)
implicit none
character(*), intent(in) :: infile
type(t_boundingbox), intent (out) :: where
character(8), intent(in) :: name
@@ -73,6 +75,7 @@ module bloubspace
! dispersion de la position autour de l'origine
!-
subroutine make_a_random_bloub(blb, coefxyz)
implicit none
type(t_bloubs), intent (out) :: blb
real, intent(in) :: coefxyz
@@ -81,25 +84,30 @@ module bloubspace
blb%py = coefxyz * (rand() - 0.50)
blb%pz = coefxyz * (rand() - 0.50)
blb%vx = (rand()) / 5.000
if (blb%px .LT. 0.0) blb%vx = -blb%vx
blb%vx = (rand() / 9.000)
! if (blb%px .LT. 0.0) blb%vx = -blb%vx
blb%vy = 0.2 + (rand()) / 8.000
if (blb%py .LT. 0.0) blb%vy = -blb%vy
blb%vy = -0.10 + (rand() / 11.000)
! if (blb%py .LT. 0.0) blb%vy = -blb%vy
blb%vz = (rand()) / 5.000
if (blb%pz .LT. 0.0) blb%vz = -blb%vz
blb%vz = (rand() / 10.000)
! if (blb%pz .LT. 0.0) blb%vz = -blb%vz
blb%red = mod(irand(), 256)
blb%green = 127 + mod(irand(), 127)
blb%blue = mod(irand(), 256)
blb%state = 0
blb%alive = .TRUE.
blb%age = 0
blb%agemax = 100
blb%agemax = 250 + mod(irand(), 250)
end subroutine
! ----------------------------------------------------------------
! Load a blbs file into an array of bloubs
subroutine spit_bloubs_to_file (fname, blbarray, towrite)
implicit none
character(*), intent(in) :: fname
type(t_bloubs), dimension(:) :: blbarray
integer, intent(in) :: towrite
@@ -131,7 +139,7 @@ module bloubspace
enddo
close(output)
write(0, '(1X, "spitted ", I0, " bloubs to .", A)') &
write(0, '(1X, "spitted ", I0, " bloubs to ", A)') &
spitted, trim(fname)
end subroutine spit_bloubs_to_file
@@ -139,6 +147,7 @@ module bloubspace
! Dump an array of bloubs to a blbs file.
!
subroutine slurp_bloubs_file_in_array (infile, blbarray, nbread)
implicit none
character(*), intent(in) :: infile
type(t_bloubs), dimension(:), intent(out) :: blbarray
integer, intent(out) :: nbread
@@ -167,7 +176,7 @@ module bloubspace
read (unit=input, iostat=errcode, iomsg=chaine) bloub
if (0 .ne. errcode) then
! may be we got an EOF ?
! write(0, '(" got errcode on read ", (I8,1X,A))') errcode, chaine
! write(0, '("errcode on read ", (I0,1X,A))') errcode, chaine
exit
endif
nbread = nbread + 1
@@ -189,6 +198,7 @@ module bloubspace
! Display a bloub content to stderr
subroutine display_bloub (blb, message)
implicit none
type(t_bloubs), intent (in) :: blb
character(*), intent (in) :: message
@@ -212,6 +222,7 @@ module bloubspace
! Deplacement d'un bloub
!-
subroutine move_bloub (blb, coef)
implicit none
type(t_bloubs), intent (inout) :: blb
real, intent (in) :: coef
@@ -220,6 +231,9 @@ module bloubspace
blb%py = blb%py + (blb%vy * coef)
blb%pz = blb%pz + (blb%vz * coef)
! faire vieillir le bloub
blb%age = blb%age + 1
end subroutine
! ----------------------------------------------------------------
!
@@ -229,10 +243,11 @@ module bloubspace
! vitesse. XXX
!
subroutine bound_a_bloub (blb)
implicit none
type(t_bloubs), intent (inout) :: blb
real, parameter :: SH = 6.0
real, parameter :: SV = 4.0
real, parameter :: SV = 6.0
logical :: flag
@@ -242,6 +257,7 @@ module bloubspace
if ((blb%px + blb%radius) .GT. SH) then
blb%vx = -1.0 * blb%vx
blb%px = SH - blb%radius
flag = .TRUE.
endif
if ((blb%px - blb%radius) .LT. -SH) then
blb%vx = -1.0 * blb%vx
@@ -275,12 +291,18 @@ module bloubspace
if (flag) then
blb%age = blb%age + 1
blb%radius = blb%radius * 0.9999
endif
if (blb%age .GT. blb%agemax) then
blb%alive = .FALSE.
endif
end subroutine
! ----------------------------------------------------------------
function distance_of_bloubs(bla, blb)
implicit none
type(t_bloubs), intent(in) :: bla, blb
real :: distance_of_bloubs
@@ -298,6 +320,7 @@ module bloubspace
! kill a bloub under condition(s)
subroutine green_soylent (blb)
implicit none
type(t_bloubs), intent (inout) :: blb
if (blb%age .gt. 240) then
@@ -306,7 +329,7 @@ module bloubspace
! this is juste a molly-guard, don't worry
!
if (blb%radius .GT. 4.0) then
if (blb%radius .GT. 5.0) then
blb%alive = .FALSE.
endif
end subroutine