Compare commits
No commits in common. "ed2b04caeb54f84456fda3ad9884ee55d62173f7" and "92f6e5cf23f994ce9f22b521f52d7f0614273008" have entirely different histories.
ed2b04caeb
...
92f6e5cf23
1
BloubWorld/.gitignore
vendored
1
BloubWorld/.gitignore
vendored
@ -13,7 +13,6 @@ exportbloubs
|
|||||||
genbloubs
|
genbloubs
|
||||||
movebloubs
|
movebloubs
|
||||||
mergebloubs
|
mergebloubs
|
||||||
listbloubs
|
|
||||||
essai
|
essai
|
||||||
|
|
||||||
core
|
core
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
all: genbloubs movebloubs exportbloubs mergebloubs \
|
all: genbloubs movebloubs exportbloubs mergebloubs \
|
||||||
listbloubs \
|
|
||||||
essai
|
essai
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
@ -11,8 +10,8 @@ OBJS = bloubspace.o povstuff.o mathstuff.o
|
|||||||
|
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
|
|
||||||
essai: essai.f90 Makefile $(OBJS)
|
essai: essai.f90 Makefile mathstuff.o
|
||||||
gfortran $(GFOPT) $< $(OBJS) -o $@
|
gfortran $(GFOPT) $< mathstuff.o -o $@
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
|
|
||||||
@ -47,9 +46,6 @@ genbloubs: genbloubs.f90 Makefile $(OBJS)
|
|||||||
movebloubs: movebloubs.f90 Makefile $(OBJS)
|
movebloubs: movebloubs.f90 Makefile $(OBJS)
|
||||||
gfortran $(GFOPT) $< $(OBJS) -o $@
|
gfortran $(GFOPT) $< $(OBJS) -o $@
|
||||||
|
|
||||||
listbloubs: listbloubs.f90 Makefile $(OBJS)
|
|
||||||
gfortran $(GFOPT) $< $(OBJS) -o $@
|
|
||||||
|
|
||||||
exportbloubs: exportbloubs.f90 Makefile $(OBJS)
|
exportbloubs: exportbloubs.f90 Makefile $(OBJS)
|
||||||
gfortran $(GFOPT) $< $(OBJS) -o $@
|
gfortran $(GFOPT) $< $(OBJS) -o $@
|
||||||
|
|
||||||
|
@ -6,17 +6,15 @@ Le BloubWorld (que l'on appelle aussi BloubSpace) est un espace borné
|
|||||||
dans lequel se déplacent des **bloubs**, lesquels sont
|
dans lequel se déplacent des **bloubs**, lesquels sont
|
||||||
des sortes de particule
|
des sortes de particule
|
||||||
munie de certaines propriétés (age, grosseur, vitesses, etc...).
|
munie de certaines propriétés (age, grosseur, vitesses, etc...).
|
||||||
Lesquelles valeurs peuvent évoluer en fonction du temps.
|
Lesquelles évoluent en fonction du temps.
|
||||||
|
|
||||||
## Description d'un bloub
|
## Description d'un bloub
|
||||||
|
|
||||||
Attention cette description n'est qu'un exemple !
|
|
||||||
|
|
||||||
```
|
```
|
||||||
type t_bloubs
|
type t_bloubs
|
||||||
character(8) :: nick
|
character(8) :: nick
|
||||||
logical :: alive
|
logical :: alive
|
||||||
integer :: state
|
integer :: num
|
||||||
real :: px, py, pz
|
real :: px, py, pz
|
||||||
real :: vx, vy, vz
|
real :: vx, vy, vz
|
||||||
real :: radius
|
real :: radius
|
||||||
@ -69,18 +67,14 @@ Sortie sur `stdout` de certaines propriétes des bloubs, qui seront
|
|||||||
reprise par un (ou des) scripts écrits en `awk`, afin de générer
|
reprise par un (ou des) scripts écrits en `awk`, afin de générer
|
||||||
ce qu'il faut pour les différents moteurs de rendu.
|
ce qu'il faut pour les différents moteurs de rendu.
|
||||||
|
|
||||||
Bon, pour le moment, il n'y a que POVray, mais Gnuplot arrivera en second.
|
Bon, pour le moment, il n'y a que POVray :)
|
||||||
|
|
||||||
### mergebloubs
|
### mergebloubs
|
||||||
|
|
||||||
Alors, celui-ci, il n'est pas vraiment au point. Il faut tout ré-écrire
|
Alors, celui-ci, il n'est pas vraiment au point.
|
||||||
et faire gaffe à l'explosion quadratique.
|
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
- Concevoir un système de _bouding box_ facile à utiliser
|
- Concevoir un système de _bouding box_ facile à utiliser
|
||||||
- Réfléchir à une politique de vieillissement des bloubs
|
- Réfléchir à une politique de vieillissement des bloubs
|
||||||
- le `merge` de deux bloubs est-il un acte politique ?
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
cube -0.35 -0.5 -0.5 5.0 5.0 5.0
|
|
@ -11,139 +11,35 @@ module bloubspace
|
|||||||
type t_bloubs
|
type t_bloubs
|
||||||
character(8) :: nick
|
character(8) :: nick
|
||||||
logical :: alive
|
logical :: alive
|
||||||
integer :: state
|
|
||||||
integer :: num ! ???
|
integer :: num ! ???
|
||||||
real :: px, py, pz
|
real :: px, py, pz
|
||||||
real :: vx, vy, vz
|
real :: vx, vy, vz
|
||||||
real :: radius
|
real :: radius
|
||||||
integer :: age, agemax
|
integer :: age
|
||||||
end type t_bloubs
|
end type t_bloubs
|
||||||
|
|
||||||
type t_boundingbox
|
|
||||||
character(8) :: id
|
|
||||||
real :: xm, ym, zm
|
|
||||||
real :: xp, yp, zp
|
|
||||||
end type t_boundingbox
|
|
||||||
|
|
||||||
contains ! -----------------------------------------
|
contains ! -----------------------------------------
|
||||||
|
|
||||||
! ----------------------------------------------------------------
|
|
||||||
|
|
||||||
subroutine load_boundingbox(infile, where, name)
|
|
||||||
character(*), intent(in) :: infile
|
|
||||||
type(t_boundingbox), intent (out) :: where
|
|
||||||
character(8), intent(in) :: name
|
|
||||||
|
|
||||||
integer :: fd, errcode
|
|
||||||
character(200) :: message
|
|
||||||
|
|
||||||
print *, "try to load ", infile
|
|
||||||
|
|
||||||
! put some default values
|
|
||||||
where%id = "default"
|
|
||||||
where%xm = -5.0 ; where%ym = -5.0 ; where%zm = -5.0
|
|
||||||
where%xp = 5.0 ; where%yp = 5.0 ; where%zp = 5.0
|
|
||||||
|
|
||||||
! and now, try to read the file
|
|
||||||
open (newunit=fd, file=trim(infile), &
|
|
||||||
status='old', action='read', &
|
|
||||||
iostat=errcode, iomsg=message)
|
|
||||||
if (errcode .NE. 0) then
|
|
||||||
stop 'OPEN ERROR ' // message
|
|
||||||
endif
|
|
||||||
|
|
||||||
do
|
|
||||||
read(unit=fd, iostat=errcode, iomsg=message, &
|
|
||||||
fmt='(A,6F8.3)') where
|
|
||||||
if (errcode .NE. 0) then
|
|
||||||
! print *, "errcode ", errcode
|
|
||||||
print *, "message: ", message
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
enddo
|
|
||||||
|
|
||||||
close(fd)
|
|
||||||
|
|
||||||
end subroutine load_boundingbox
|
|
||||||
|
|
||||||
! ----------------------------------------------------------------
|
|
||||||
|
|
||||||
subroutine random_pv (blb)
|
subroutine random_pv (blb)
|
||||||
type(t_bloubs), intent (out) :: blb
|
type(t_bloubs), intent (inout) :: blb
|
||||||
|
|
||||||
blb%px = 4.33 * (rand() - 0.50)
|
blb%px = 1.35 * (rand() - 0.50)
|
||||||
blb%py = 3.33 * (rand() - 0.50)
|
blb%py = 0.50 + (rand() * 0.50)
|
||||||
blb%pz = 4.51 * (rand() - 0.50)
|
blb%pz = 1.90 * (rand() - 0.50)
|
||||||
|
|
||||||
blb%vx = (rand()) / 2.000
|
blb%vx = (rand() - 0.5) / 2.500
|
||||||
blb%vy = (rand()) / 2.900
|
blb%vy = (rand() - 0.1) / 4.000
|
||||||
blb%vz = (rand()) / 2.000
|
blb%vz = (rand() - 0.5) / 2.500
|
||||||
|
|
||||||
blb%state = 0
|
blb%alive = .TRUE.
|
||||||
blb%alive = .TRUE.
|
|
||||||
blb%age = 0
|
|
||||||
blb%agemax = 500
|
|
||||||
|
|
||||||
end subroutine
|
end subroutine
|
||||||
! ----------------------------------------------------------------
|
! ----------------------------------------------------------------
|
||||||
! Load a blbs file into an array of bloubs
|
! Load a blbs file into an array of bloubs
|
||||||
subroutine spit_bloubs_to_file (fname, blbarray, towrite)
|
|
||||||
|
|
||||||
character(*), intent(in) :: fname
|
|
||||||
type(t_bloubs), dimension(:) :: blbarray
|
|
||||||
integer, intent(in) :: towrite
|
|
||||||
|
|
||||||
write (0, '(" spiting", (I6), "bloubs to", (A), "file")') &
|
|
||||||
towrite, trim(fname)
|
|
||||||
|
|
||||||
STOP ' : NOT IMPLEMENTED'
|
|
||||||
|
|
||||||
end subroutine
|
|
||||||
! ----------------------------------------------------------------
|
! ----------------------------------------------------------------
|
||||||
! Dump an array of bloubs to a blbs file.
|
! Dump an array of bloubs to a blbs file.
|
||||||
!
|
|
||||||
subroutine slurp_bloubs_file_in_array (infile, blbarray, nbread)
|
|
||||||
character(*), intent(in) :: infile
|
|
||||||
type(t_bloubs), dimension(:), intent(out) :: blbarray
|
|
||||||
integer, intent(out) :: nbread
|
|
||||||
|
|
||||||
character(200) :: chaine
|
|
||||||
integer :: input, errcode, idx
|
|
||||||
type(t_bloubs) :: bloub
|
|
||||||
|
|
||||||
write(0, '(" slurping from file [", (A), "]")') trim(infile)
|
|
||||||
|
|
||||||
open( newunit=input, &
|
|
||||||
file=trim(infile), form='unformatted', &
|
|
||||||
iostat=errcode, iomsg=chaine, &
|
|
||||||
action='read', status='old')
|
|
||||||
if (0 .ne. errcode) then
|
|
||||||
write(0, '(" errcode ", I8, 2X, A)') errcode, chaine
|
|
||||||
STOP " : CAN'T OPEN FILE " // trim(infile)
|
|
||||||
endif
|
|
||||||
! write(0, '((A, I3))') " slurping from unit ", input
|
|
||||||
|
|
||||||
nbread = 0
|
|
||||||
idx = 1;
|
|
||||||
do
|
|
||||||
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
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
nbread = nbread + 1
|
|
||||||
! print *, bloub%nick, bloub%radius
|
|
||||||
if (bloub%alive) then
|
|
||||||
blbarray(idx) = bloub
|
|
||||||
idx = idx + 1
|
|
||||||
endif
|
|
||||||
enddo
|
|
||||||
|
|
||||||
close(input) ! no error checking ?
|
|
||||||
|
|
||||||
write(0, '(" read ", (I8), " bloubs")') nbread
|
|
||||||
end subroutine
|
|
||||||
! ----------------------------------------------------------------
|
! ----------------------------------------------------------------
|
||||||
! Display a bloub content to stderr
|
! Display a bloub content to stderr
|
||||||
|
|
||||||
@ -156,7 +52,7 @@ module bloubspace
|
|||||||
if (blb%alive) then
|
if (blb%alive) then
|
||||||
life = "alive"
|
life = "alive"
|
||||||
else
|
else
|
||||||
life = "dead "
|
life = "dead"
|
||||||
endif
|
endif
|
||||||
write (0, '(4X, A)') '+--------------- ' // message // " -------"
|
write (0, '(4X, A)') '+--------------- ' // message // " -------"
|
||||||
write (0, '(4X,A3,A8,2X,I6,4X,A5,4X,I5)') '| ', &
|
write (0, '(4X,A3,A8,2X,I6,4X,A5,4X,I5)') '| ', &
|
||||||
@ -180,42 +76,37 @@ module bloubspace
|
|||||||
|
|
||||||
end subroutine
|
end subroutine
|
||||||
! ----------------------------------------------------------------
|
! ----------------------------------------------------------------
|
||||||
!
|
|
||||||
! detection des collisions avec les parois de la boite
|
|
||||||
! laquelle boite gagnerais beaucoup a etre parametrable.
|
|
||||||
!
|
|
||||||
subroutine bound_a_blob (blb)
|
subroutine bound_a_blob (blb)
|
||||||
type(t_bloubs), intent (inout) :: blb
|
type(t_bloubs), intent (inout) :: blb
|
||||||
|
|
||||||
if ( 5.0 .lt. (blb%px + blb%radius)) then
|
if (5.0 .lt. blb%px) then
|
||||||
blb%vx = -1.0 * blb%vx
|
blb%vx = -1.0 * blb%vx
|
||||||
blb%px = 5.0
|
blb%px = 5.0
|
||||||
blb%age = blb%age + 1
|
blb%age = blb%age + 1
|
||||||
endif
|
endif
|
||||||
if (-5.0 .gt. (blb%px + blb%radius)) then
|
if (-5.0 .gt. blb%px) then
|
||||||
blb%vx = -1.0 * blb%vx
|
blb%vx = -1.0 * blb%vx
|
||||||
blb%px = -5.0
|
blb%px = -5.0
|
||||||
blb%age = blb%age + 1
|
blb%age = blb%age + 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
! vertical axe
|
if (0.0 .gt. blb%py) then
|
||||||
if (-4.99 .gt. (blb%py + blb%radius)) then
|
|
||||||
blb%vy = -1.0 * blb%vy
|
blb%vy = -1.0 * blb%vy
|
||||||
blb%py = blb%radius
|
blb%py = 0.0
|
||||||
blb%age = blb%age + 1
|
blb%age = blb%age + 1
|
||||||
endif
|
endif
|
||||||
if ( 4.99 .lt. (blb%py + blb%radius)) then ! overshoot ?
|
if (4.99 .lt. blb%py) then !!
|
||||||
blb%vy = -1.0 * blb%vy
|
blb%vy = -1.0 * blb%vy
|
||||||
blb%age = blb%age + 1
|
blb%age = blb%age + 1
|
||||||
blb%py = 5.0 - blb%radius !!
|
blb%py = 4.99 !!
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if ( 5.0 .lt. (blb%pz + blb%radius)) then
|
if (5.0 .lt. blb%pz) then
|
||||||
blb%vz = -1.0 * blb%vz
|
blb%vz = -1.0 * blb%vz
|
||||||
blb%age = blb%age + 1
|
blb%age = blb%age + 1
|
||||||
blb%pz = 5.0
|
blb%pz = 5.0
|
||||||
endif
|
endif
|
||||||
if (-5.0 .gt. (blb%pz + blb%radius)) then
|
if (-5.0 .gt. blb%pz) then
|
||||||
blb%vz = -1.0 * blb%vz
|
blb%vz = -1.0 * blb%vz
|
||||||
blb%age = blb%age + 1
|
blb%age = blb%age + 1
|
||||||
blb%pz = -5.0
|
blb%pz = -5.0
|
||||||
@ -243,14 +134,7 @@ module bloubspace
|
|||||||
|
|
||||||
subroutine green_soylent (blb)
|
subroutine green_soylent (blb)
|
||||||
type(t_bloubs), intent (inout) :: blb
|
type(t_bloubs), intent (inout) :: blb
|
||||||
|
if (blb%age .gt. 8) then
|
||||||
if (blb%age .gt. 18) then
|
|
||||||
blb%alive = .FALSE.
|
|
||||||
endif
|
|
||||||
|
|
||||||
! this is juste a molly-guard, don't worry
|
|
||||||
!
|
|
||||||
if (blb%radius .GT. 2.0) then
|
|
||||||
blb%alive = .FALSE.
|
blb%alive = .FALSE.
|
||||||
endif
|
endif
|
||||||
end subroutine
|
end subroutine
|
||||||
|
@ -1,39 +1,19 @@
|
|||||||
program essai
|
program essai
|
||||||
|
|
||||||
use bloubspace
|
|
||||||
use mathstuff
|
use mathstuff
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
type(t_boundingbox) :: bbox
|
integer :: foo
|
||||||
|
|
||||||
call load_boundingbox("WS/boundinboxes.dat", bbox, "cube ")
|
|
||||||
|
|
||||||
print *, bbox
|
|
||||||
|
|
||||||
|
|
||||||
! call test_random(20)
|
|
||||||
|
|
||||||
|
|
||||||
STOP ': BECAUSE JOB IS DONE'
|
|
||||||
|
|
||||||
! --------------------------------------------------------------
|
|
||||||
contains
|
|
||||||
|
|
||||||
subroutine test_random(nbre)
|
|
||||||
integer, intent(in) :: nbre
|
|
||||||
integer :: foo, bar
|
|
||||||
real :: quux
|
real :: quux
|
||||||
double precision :: somme
|
double precision :: somme
|
||||||
|
|
||||||
call init_random_seed() ! in module 'mathstuff'
|
call init_random_seed()
|
||||||
somme = 0.0
|
somme = 0.0
|
||||||
do foo=1, nbre
|
|
||||||
|
do foo=1, 5
|
||||||
quux = rand()
|
quux = rand()
|
||||||
somme = somme + quux
|
somme = somme + quux
|
||||||
bar = mod(irand(), 7)
|
print *, foo, quux, somme/foo
|
||||||
print *, foo, quux, somme/foo, bar
|
|
||||||
enddo
|
enddo
|
||||||
end subroutine test_random
|
|
||||||
! --------------------------------------------------------------
|
|
||||||
|
|
||||||
end program
|
end program
|
@ -18,20 +18,22 @@ program genbloubs
|
|||||||
call getarg(2, str)
|
call getarg(2, str)
|
||||||
read(str,*) nbbloubs
|
read(str,*) nbbloubs
|
||||||
|
|
||||||
write (0, '(A,I8,A)') &
|
write (0, '(A,I6,A)') &
|
||||||
"*** generating ", nbbloubs, " bloubs to "//trim(filename)
|
"*** generating ", nbbloubs, " bloubs to "//trim(filename)
|
||||||
|
|
||||||
open(newunit=idu, file=trim(filename), &
|
! print *, "generating ", nbbloubs, "bloubs to ", filename
|
||||||
form='unformatted', &
|
|
||||||
access="sequential", &
|
open(newunit=idu, file=trim(filename), form='unformatted', &
|
||||||
action='write', status='replace')
|
action='write', status='replace')
|
||||||
|
|
||||||
do i = 1, nbbloubs
|
do i = 1, nbbloubs
|
||||||
|
|
||||||
bloub%nick = 'noname '
|
bloub%nick = 'noname '
|
||||||
bloub%num = i + 41
|
bloub%num = i + 41
|
||||||
|
bloub%alive = .TRUE.
|
||||||
call random_pv(bloub)
|
call random_pv(bloub)
|
||||||
bloub%radius = 0.035 + (0.03*rand())
|
bloub%radius = 0.025
|
||||||
|
bloub%age = 0
|
||||||
|
|
||||||
write(idu) bloub ! no error control ?
|
write(idu) bloub ! no error control ?
|
||||||
|
|
||||||
|
@ -1,45 +0,0 @@
|
|||||||
program movebloubs
|
|
||||||
|
|
||||||
use bloubspace
|
|
||||||
implicit none
|
|
||||||
|
|
||||||
integer, parameter :: NB_MAX_BLOUBS = 200000
|
|
||||||
|
|
||||||
! --------------------------------------------------------------
|
|
||||||
character(200) :: infile
|
|
||||||
integer :: errcode, i
|
|
||||||
integer :: nbgot
|
|
||||||
type(t_bloubs), dimension(:), allocatable :: bloubs
|
|
||||||
|
|
||||||
i = IARGC()
|
|
||||||
if (i .ne. 1) then
|
|
||||||
STOP ": BAD ARG ON COMMAND LINE"
|
|
||||||
endif
|
|
||||||
call getarg(1, infile)
|
|
||||||
|
|
||||||
write (0, '(A)') &
|
|
||||||
"*** listing bloubs from "//trim(infile)
|
|
||||||
|
|
||||||
allocate (bloubs(NB_MAX_BLOUBS), stat=errcode)
|
|
||||||
if (0 .NE. errcode) then
|
|
||||||
STOP " : NO ENOUGH MEMORY"
|
|
||||||
endif
|
|
||||||
do i = 1, NB_MAX_BLOUBS
|
|
||||||
bloubs(i)%alive = .FALSE.
|
|
||||||
enddo
|
|
||||||
|
|
||||||
call slurp_bloubs_file_in_array(trim(infile), bloubs, nbgot)
|
|
||||||
write(0, '(A,I6,1X,A)') "slurped ", nbgot, "bloubs"
|
|
||||||
|
|
||||||
do i=1,nbgot
|
|
||||||
write(6, '(A8, 1X, 1L, 1X, I2, 3X, F8.3, 3X, 3F8.3, 3X, 3F8.3)') &
|
|
||||||
bloubs(i)%nick, bloubs(i)%alive, &
|
|
||||||
bloubs(i)%state, &
|
|
||||||
bloubs(i)%radius, &
|
|
||||||
bloubs(i)%px, bloubs(i)%py, bloubs(i)%pz, &
|
|
||||||
bloubs(i)%vx, bloubs(i)%vy, bloubs(i)%vz
|
|
||||||
enddo
|
|
||||||
|
|
||||||
end program
|
|
||||||
|
|
||||||
! \o_
|
|
@ -5,23 +5,21 @@ module mathstuff
|
|||||||
|
|
||||||
! ----------------------------------------------------------------
|
! ----------------------------------------------------------------
|
||||||
! really quick'n'dirty hack
|
! really quick'n'dirty hack
|
||||||
! not really tested yet...
|
! not working yet...
|
||||||
|
|
||||||
subroutine init_random_seed()
|
subroutine init_random_seed()
|
||||||
|
|
||||||
integer, dimension(3) :: tarray
|
integer, dimension(3) :: tarray
|
||||||
integer :: t3, foo
|
integer :: t3
|
||||||
real :: dummy
|
real :: dummy
|
||||||
call itime(tarray)
|
call itime(tarray)
|
||||||
t3 = 3600*tarray(1) + 60*tarray(2) + tarray(3)
|
t3 = 3600*tarray(1) + 60*tarray(2) + tarray(3)
|
||||||
! write(0, '(A,3I3,A,I6)') "sranding: ", tarray, " --> ", t3
|
write(0, '(A,3I3,A,I6)') "sranding: ", tarray, " --> ", t3
|
||||||
call srand(t3)
|
call srand(t3)
|
||||||
|
|
||||||
! after initializing the random generator engine,
|
! after initializing the random generator engine,
|
||||||
! you MUST use it for initializing the initializer
|
! you MUST use it for initializing the initializer
|
||||||
do foo=1, tarray(1)+5
|
dummy = rand()
|
||||||
dummy = rand()
|
|
||||||
enddo
|
|
||||||
|
|
||||||
end subroutine
|
end subroutine
|
||||||
|
|
||||||
|
@ -42,8 +42,6 @@ program movebloubs
|
|||||||
STOP " : CAN'T OPEN " // trim(outfile) // "FOR WRITE"
|
STOP " : CAN'T OPEN " // trim(outfile) // "FOR WRITE"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
! write(0, '("Units: ", 2I5)') inu, outu
|
|
||||||
|
|
||||||
bx = 0.0; by = 0.0; bz = 0.0
|
bx = 0.0; by = 0.0; bz = 0.0
|
||||||
compteur = 0
|
compteur = 0
|
||||||
killed = 0
|
killed = 0
|
||||||
@ -55,20 +53,18 @@ program movebloubs
|
|||||||
exit
|
exit
|
||||||
endif
|
endif
|
||||||
|
|
||||||
! moving, morphing and boundingboxing
|
! moving and boundingboxing
|
||||||
call move_bloub (bloub, 0.185)
|
call move_bloub (bloub, 0.14)
|
||||||
call bound_a_blob (bloub)
|
call bound_a_blob (bloub)
|
||||||
if (bloub%radius .GT. 0.0151) then
|
if (bloub%radius .GT. 0.052) then
|
||||||
bloub%radius = bloub%radius * 0.9970
|
bloub%radius = bloub%radius * 0.985
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call green_soylent (bloub)
|
call green_soylent (bloub)
|
||||||
if (.NOT. bloub%alive) then
|
if (.NOT. bloub%alive) then
|
||||||
! write(0, '(A)') " KILL!"
|
! write(0, '(A)') " KILL!"
|
||||||
killed = killed + 1
|
killed = killed + 1
|
||||||
! cycle ! ???
|
cycle
|
||||||
endif
|
endif
|
||||||
|
|
||||||
! calcul du barycentre
|
! calcul du barycentre
|
||||||
bx = bx + dble(bloub%px)
|
bx = bx + dble(bloub%px)
|
||||||
by = by + dble(bloub%py)
|
by = by + dble(bloub%py)
|
||||||
@ -87,11 +83,11 @@ program movebloubs
|
|||||||
! ok, we have read all the bloubs in the input file
|
! ok, we have read all the bloubs in the input file
|
||||||
|
|
||||||
! insert some fancy conditional here
|
! insert some fancy conditional here
|
||||||
if (compteur .LT. 3000) then
|
if (compteur .LT. 1600) then
|
||||||
rnd = rand()
|
rnd = rand()
|
||||||
write (0, '(A,1X,F9.6)') "try to add bloubs, rnd is", rnd
|
write (0, '(A,1X,F5.3)') "try to add bloubs, rnd is", rnd
|
||||||
if (rnd .LT. 0.0450) then
|
if (rnd .LT. 0.02) then
|
||||||
call add_more_bloubs(outu, 24, 0.0990)
|
call add_more_bloubs(outu, 12, 0.210)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -109,23 +105,22 @@ program movebloubs
|
|||||||
! --------------------------------------------------------------
|
! --------------------------------------------------------------
|
||||||
contains
|
contains
|
||||||
|
|
||||||
subroutine add_more_bloubs(un, nbre, rayon)
|
subroutine add_more_bloubs(un, nbre, wtf)
|
||||||
integer, intent(in) :: un, nbre
|
integer, intent(in) :: un, nbre
|
||||||
real, intent(in) :: rayon
|
real, intent(in) :: wtf
|
||||||
type(t_bloubs) :: bloub
|
type(t_bloubs) :: bloub
|
||||||
integer :: foo, count
|
integer :: foo
|
||||||
|
|
||||||
count = nbre+mod(irand(), 7)
|
write(0, '(A,I4,1X,A)') "adding", nbre, "bloubs"
|
||||||
write(0, '(A,I4,1X,A)') "adding", count, "bloubs"
|
|
||||||
|
|
||||||
do foo=1, count
|
do foo=1, nbre
|
||||||
|
|
||||||
bloub%nick = 'newbie '
|
bloub%nick = 'newbie '
|
||||||
call random_pv(bloub)
|
call random_pv(bloub)
|
||||||
bloub%radius = rayon + (0.15*rand())
|
bloub%radius = wtf
|
||||||
bloub%age = 1
|
bloub%age = 1
|
||||||
bloub%alive = .TRUE.
|
bloub%alive = .TRUE.
|
||||||
bloub%num = mod(irand(), 42)
|
! call display_bloub (bloub, "new bloub")
|
||||||
write(un) bloub ! no error control ?
|
write(un) bloub ! no error control ?
|
||||||
|
|
||||||
enddo
|
enddo
|
||||||
|
@ -7,15 +7,15 @@
|
|||||||
|
|
||||||
INCFILE="WS/bloubs.inc"
|
INCFILE="WS/bloubs.inc"
|
||||||
TMPPNG="/dev/shm/bloubs7.png"
|
TMPPNG="/dev/shm/bloubs7.png"
|
||||||
POVOPT="+Q9 +a -v -d -W1600 -H1200 -WT2"
|
POVOPT="+Q9 +a -v -d -W1024 -H768 -WT2"
|
||||||
DDIR="frames/a"
|
DDIR="frames"
|
||||||
LOGERR="log.error"
|
LOGERR="log.error"
|
||||||
|
|
||||||
# --- put the work file in ramdisk
|
# --- put the work file in ramdisk
|
||||||
BLBS_IN="/dev/shm/in.blbs"
|
BLBS_IN="/dev/shm/in.blbs"
|
||||||
BLBS_OUT="/dev/shm/out.blbs"
|
BLBS_OUT="/dev/shm/out.blbs"
|
||||||
|
|
||||||
NBIMG=3000
|
NBIMG=1800
|
||||||
|
|
||||||
make all
|
make all
|
||||||
err=$?
|
err=$?
|
||||||
@ -30,9 +30,9 @@ printf "\n#declare NbImg = %d;\n" $NBIMG > WS/nbimg.inc
|
|||||||
# first, we have to make a seminal buch of bloubs
|
# first, we have to make a seminal buch of bloubs
|
||||||
# --> this function need to be parametrizable
|
# --> this function need to be parametrizable
|
||||||
#
|
#
|
||||||
./genbloubs ${BLBS_IN} 3000
|
./genbloubs ${BLBS_IN} 15
|
||||||
|
|
||||||
for idx in $(seq 0 $((NBIMG-1)) )
|
for idx in $(seq 0 $NBIMG)
|
||||||
do
|
do
|
||||||
|
|
||||||
echo "======== run passe $idx ========="
|
echo "======== run passe $idx ========="
|
||||||
@ -43,41 +43,45 @@ do
|
|||||||
if [ 0 -ne $? ] ; then
|
if [ 0 -ne $? ] ; then
|
||||||
tail -15 $LOGERR
|
tail -15 $LOGERR
|
||||||
sleep 30
|
sleep 30
|
||||||
|
else
|
||||||
|
grep "Trace Time" $LOGERR
|
||||||
fi
|
fi
|
||||||
|
|
||||||
td=$(date +'%F %R:%S')
|
td=$(date +'%F %R:%S')
|
||||||
hi=$(printf "#%05d" $idx)
|
hi=$(printf "#%05d" $idx)
|
||||||
count=$(tail -1 "WS/log.nb_bloubs")
|
count=$(head -1 "WS/log.nb_bloubs")
|
||||||
|
|
||||||
PNG=$(printf "%s/%05d.png" ${DDIR} $idx)
|
PNG=$(printf "%s/%05d.png" ${DDIR} $idx)
|
||||||
|
|
||||||
convert ${TMPPNG} \
|
convert ${TMPPNG} \
|
||||||
-font Courier-Bold \
|
-font Courier-Bold \
|
||||||
-pointsize 24 \
|
-pointsize 16 \
|
||||||
-fill Yellow \
|
-fill Orange \
|
||||||
-gravity south-east \
|
-gravity south-east \
|
||||||
-annotate +25+5 "$td" \
|
-annotate +15+10 "$td" \
|
||||||
-gravity south-west \
|
-gravity south-west \
|
||||||
-annotate +25+5 "$hi" \
|
-annotate +15+10 "$hi" \
|
||||||
-fill Yellow \
|
-fill Yellow \
|
||||||
-pointsize 48 \
|
-pointsize 32 \
|
||||||
-gravity north-east \
|
-gravity north-east \
|
||||||
-annotate +25+5 "$count" \
|
-annotate +15+10 "$count" \
|
||||||
-gravity north-west \
|
|
||||||
-annotate +25+5 "BloubWorld" \
|
|
||||||
$PNG
|
$PNG
|
||||||
|
|
||||||
echo $PNG '[done]'
|
echo $PNG '[done]'
|
||||||
|
|
||||||
./movebloubs ${BLBS_IN} ${BLBS_OUT}
|
./movebloubs ${BLBS_IN} ${BLBS_OUT}
|
||||||
# ./mergebloubs ${BLBS_OUT} ${BLBS_IN}
|
|
||||||
mv ${BLBS_OUT} ${BLBS_IN}
|
mv ${BLBS_OUT} ${BLBS_IN}
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
sleep 15
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
rm $LOGERR
|
rm $LOGERR
|
||||||
|
|
||||||
|
# XXX convert -delay 10 -resize 50% -colors 192 \
|
||||||
|
# XXX $DDIR/????[0]*.png foo.gif
|
||||||
|
|
||||||
nice ./encode.sh
|
nice ./encode.sh
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,14 +5,12 @@
|
|||||||
#version 3.7;
|
#version 3.7;
|
||||||
|
|
||||||
global_settings {
|
global_settings {
|
||||||
ambient_light rgb <0.14, 0.08, 0.08>
|
ambient_light rgb <0.12, 0.04, 0.04>
|
||||||
assumed_gamma 1.0
|
assumed_gamma 1.0
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "colors.inc"
|
#include "colors.inc"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "WS/nbimg.inc"
|
#include "WS/nbimg.inc"
|
||||||
|
|
||||||
#declare NormClock = clock / NbImg;
|
#declare NormClock = clock / NbImg;
|
||||||
@ -21,28 +19,21 @@ global_settings {
|
|||||||
|
|
||||||
#include "WS/bloubs.inc"
|
#include "WS/bloubs.inc"
|
||||||
|
|
||||||
#fopen LC "WS/log.nb_bloubs" append
|
#fopen LC "WS/log.nb_bloubs" write
|
||||||
#write (LC, " ", Nb_Bloubs, "\n")
|
#write (LC, Nb_Bloubs, "\n")
|
||||||
#fclose LC
|
#fclose LC
|
||||||
|
|
||||||
|
|
||||||
object {
|
object {
|
||||||
Bloubs
|
Bloubs
|
||||||
finish { phong 0.55 specular 0.55 }
|
finish { phong 0.33 specular 0.95 }
|
||||||
}
|
}
|
||||||
|
|
||||||
object {
|
plane {
|
||||||
union {
|
<0, 1, 0>, 0
|
||||||
plane { <1, 0, 0>, -32 }
|
texture {
|
||||||
plane { <1, 0, 0>, 32 }
|
pigment { color srgb <0.133, 0.144, 0.111> }
|
||||||
plane { <0, 1, 0>, -23 }
|
finish { phong 0.18 metallic 0.55 }
|
||||||
plane { <0, 1, 0>, 23 }
|
|
||||||
plane { <0, 0, 1>, 50 }
|
|
||||||
|
|
||||||
texture {
|
|
||||||
pigment { color srgb <0.125, 0.144, 0.111> }
|
|
||||||
finish { phong 0.18 metallic 0.25 reflection 0.35 }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,24 +41,24 @@ object {
|
|||||||
|
|
||||||
#declare BH = 5; // H = taille en horizontal
|
#declare BH = 5; // H = taille en horizontal
|
||||||
#declare BV = 5; // V = taille en vertical
|
#declare BV = 5; // V = taille en vertical
|
||||||
#declare BR = 0.028;
|
#declare BR = 0.035;
|
||||||
|
|
||||||
#declare Une_Borne = object
|
#declare Une_Borne = object
|
||||||
{
|
{
|
||||||
merge {
|
merge {
|
||||||
cylinder { <0, BV, 0>, <0, -BV, 0>, BR }
|
cylinder { <0, 0, 0>, <0, BV, 0>, BR }
|
||||||
cylinder { <0, 0.012, 0>, <0, -0.012, 0>, BR*4 }
|
cylinder { <0, 0, 0>, <0, 0.04, 0>, BR*6 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#declare Un_Cadre = object
|
#declare Un_Cadre = object
|
||||||
{
|
{
|
||||||
merge {
|
merge {
|
||||||
#local Ruc = BR * 0.90;
|
#local Ruc = BR * 0.666;
|
||||||
cylinder { <-BH, 0, -BH>, <-BH, 0, BH>, Ruc }
|
cylinder { <-BH, 0, -BH>, <-BH, 0, BH>, Ruc }
|
||||||
cylinder { < BH, 0, -BH>, < BH, 0, BH>, Ruc }
|
cylinder { < BH, 0, -BH>, < BH, 0, BH>, BR }
|
||||||
cylinder { < BH, 0, -BH>, <-BH, 0, -BH>, Ruc }
|
cylinder { < BH, 0, -BH>, <-BH, 0, -BH>, BR }
|
||||||
cylinder { < BH, 0, BH>, <-BH, 0, BH>, Ruc }
|
cylinder { < BH, 0, BH>, <-BH, 0, BH>, Ruc }
|
||||||
}
|
}
|
||||||
pigment { color Gray40 }
|
pigment { color Gray40 }
|
||||||
}
|
}
|
||||||
@ -75,9 +66,9 @@ pigment { color Gray40 }
|
|||||||
#declare Les_Bornes = object
|
#declare Les_Bornes = object
|
||||||
{
|
{
|
||||||
union {
|
union {
|
||||||
#local E = 0.002;
|
#local E = 0.02;
|
||||||
object { Un_Cadre translate y*(BV-E) }
|
object { Un_Cadre translate y*(BV-E) }
|
||||||
object { Un_Cadre translate -y*(BV-E) }
|
object { Un_Cadre translate y*E }
|
||||||
|
|
||||||
object { Une_Borne translate <-BH, 0, -BH> pigment { color Blue } }
|
object { Une_Borne translate <-BH, 0, -BH> pigment { color Blue } }
|
||||||
object { Une_Borne translate < BH, 0, -BH> pigment { color Green } }
|
object { Une_Borne translate < BH, 0, -BH> pigment { color Green } }
|
||||||
@ -109,22 +100,24 @@ union {
|
|||||||
}
|
}
|
||||||
// ----------------------------------------------------------
|
// ----------------------------------------------------------
|
||||||
|
|
||||||
light_source { <19, -12, -17> color Gray80 }
|
// object { Repere scale 2+(1.9*NormClock) translate y*2.5 }
|
||||||
light_source { <11, 14, 9> color Gray60 }
|
|
||||||
|
|
||||||
#declare XCAM = 8 - ( 15 * NormClock);
|
light_source { <9, 22, -17> color Gray80 }
|
||||||
#declare YCAM = 1 + (0.75 * NormClock);
|
light_source { <11, 19, 9> color Gray60 }
|
||||||
#declare ZCAM = -17.5;
|
|
||||||
|
|
||||||
#declare XLAT = Bary_X;
|
#declare XCAM = 8 - ( 8 * NormClock);
|
||||||
#declare YLAT = Bary_Y;
|
#declare YCAM = 5 + ( 6 * NormClock);
|
||||||
#declare ZLAT = Bary_Z;
|
#declare ZCAM = -17;
|
||||||
|
|
||||||
// object { Repere scale 2.5 translate <XLAT, YLAT, ZLAT> }
|
/*
|
||||||
|
#fopen LC "WS/log.camera" append
|
||||||
|
#write (LC, clock, " ", NormClock, " ", YCAM, "\n")
|
||||||
|
#fclose LC
|
||||||
|
*/
|
||||||
|
|
||||||
camera {
|
camera {
|
||||||
location <XCAM, YCAM, ZCAM>
|
location <XCAM, YCAM, ZCAM>
|
||||||
look_at <XLAT, YLAT, ZLAT>
|
look_at <0, 1.5, 0>
|
||||||
right x*image_width/image_height
|
right x*image_width/image_height
|
||||||
angle 66
|
angle 42
|
||||||
}
|
}
|
||||||
|
@ -5,22 +5,17 @@
|
|||||||
|
|
||||||
BEGIN {
|
BEGIN {
|
||||||
count = 0
|
count = 0
|
||||||
bx = by = bz = 0.0
|
|
||||||
print "// GENERATED FILE, DON'T TOUCH IT !"
|
print "// GENERATED FILE, DON'T TOUCH IT !"
|
||||||
print "#declare Bloubs = object\n{"
|
print "#declare Bloubs = object\n{"
|
||||||
print "union\t{"
|
print "union\t{"
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
age = $5
|
if ($5 > 4) color = "Magenta"
|
||||||
if (age < 2) color = "Orange"
|
else color = "Cyan"
|
||||||
else if (age > 8) color = "Gray70"
|
|
||||||
else color = "Sienna"
|
|
||||||
bx += $1
|
|
||||||
by += $2
|
|
||||||
bz += $3
|
|
||||||
pigment = "pigment { color " color " }"
|
pigment = "pigment { color " color " }"
|
||||||
printf "\tsphere { <%f, %f, %f>, %f %s }\n", \
|
printf "\t\tsphere { <%f, %f, %f>, %f %s }\n", \
|
||||||
$1, $2, $3, $4, pigment
|
$1, $2, $3, $4, pigment
|
||||||
count++
|
count++
|
||||||
}
|
}
|
||||||
@ -28,7 +23,4 @@ BEGIN {
|
|||||||
END {
|
END {
|
||||||
print "\t} // end of union\n}\n"
|
print "\t} // end of union\n}\n"
|
||||||
print "#declare Nb_Bloubs = ", count, ";\n"
|
print "#declare Nb_Bloubs = ", count, ";\n"
|
||||||
print "#declare Bary_X = ", bx/count, ";";
|
|
||||||
print "#declare Bary_Y = ", by/count, ";";
|
|
||||||
print "#declare Bary_Z = ", bz/count, ";";
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user