Fortraneries/BloubWorld/mergebloubs.f90

61 lines
1.5 KiB
Fortran
Raw Normal View History

2022-02-16 17:10:05 +01:00
program mergebloubs
2022-03-18 22:08:08 +01:00
!-------------------------------------------!
! THIS IS A BIG MESS OF BUGS !
!-------------------------------------------!
2022-02-16 17:10:05 +01:00
use bloubspace
implicit none
2022-02-18 19:30:10 +01:00
integer, parameter :: NB_MAX_BLOUBS = 25000
2022-02-16 17:10:05 +01:00
character(200) :: infile, outfile
type(t_bloubs) :: bloub, newbloub
integer :: inu, outu, errcode
type(t_bloubs), dimension(:), allocatable :: les_bloubs
2022-03-20 22:05:06 +01:00
2022-02-16 17:10:05 +01:00
! --------------- check command line parameters
if (IARGC() .ne. 2) then
STOP ": NEED IN AND OUT FILENAME"
endif
call getarg(1, infile)
call getarg(2, outfile)
2022-03-18 22:08:08 +01:00
write(0, '(A, 2A20, I8)') "*** mergebloubs ", &
trim(infile), trim(outfile), NB_MAX_BLOUBS
2022-02-16 17:10:05 +01:00
2022-03-18 22:08:08 +01:00
2022-03-20 22:05:06 +01:00
STOP '[done]'
2022-02-16 17:10:05 +01:00
! --------------------------------------------------------------
contains
subroutine merge_two_bloubs(bla, blb, blr)
type(t_bloubs), intent(in) :: bla, blb
type(t_bloubs), intent(out) :: blr
2022-03-20 22:05:06 +01:00
blr%nick = "merged "
2022-02-16 17:10:05 +01:00
blr%num = 0 ! ???
blr%px = (bla%px + blb%px) / 2.0
blr%py = (bla%py + blb%py) / 2.0
blr%pz = (bla%pz + blb%pz) / 2.0
blr%vx = (bla%vx + blb%vx) / 2.0
blr%vy = (bla%vy + blb%vy) / 2.0
blr%vz = (bla%vz + blb%vz) / 2.0
2022-03-18 22:08:08 +01:00
blr%radius = (bla%radius + blb%radius) / 2.718
2022-02-16 17:10:05 +01:00
blr%age = min(bla%age, blb%age)
! bring it to life !
blr%alive = .TRUE.
end subroutine
end program