ready for another run ?

This commit is contained in:
tth 2022-02-18 19:30:10 +01:00
parent 64206904ca
commit 47a383f3b6
9 changed files with 66 additions and 34 deletions

View File

@ -1,6 +1,7 @@
all: genbloubs movebloubs exportbloubs mergebloubs
all: genbloubs movebloubs exportbloubs mergebloubs \
essai
# ------------------------------------------------------------

3
BloubWorld/WS/README.md Normal file
View File

@ -0,0 +1,3 @@
# Work Space
Where the progs put their work file.

View File

@ -11,7 +11,7 @@ module bloubspace
type t_bloubs
character(8) :: nick
logical :: alive
integer :: num
integer :: num ! ???
real :: px, py, pz
real :: vx, vy, vz
real :: radius
@ -23,18 +23,25 @@ module bloubspace
subroutine random_pv (blb)
type(t_bloubs), intent (inout) :: blb
blb%px = 1.3 * (rand() - 0.50)
blb%py = 0.50 + rand() * 0.50
blb%pz = 2.0 * (rand() - 0.50)
blb%px = 1.35 * (rand() - 0.50)
blb%py = 0.50 + (rand() * 0.50)
blb%pz = 1.90 * (rand() - 0.50)
blb%vx = (rand() - 0.5) / 2.500
blb%vy = (rand() - 0.5) / 4.000
blb%vy = (rand() - 0.1) / 4.000
blb%vz = (rand() - 0.5) / 2.500
blb%alive = .TRUE.
end subroutine
! ----------------------------------------------------------------
! Load a blbs file into an array of bloubs
! ----------------------------------------------------------------
! Dump an array of bloubs to a blbs file.
! ----------------------------------------------------------------
! Display a bloub content to stderr
subroutine display_bloub (blb, message)
type(t_bloubs), intent (in) :: blb
@ -127,7 +134,7 @@ module bloubspace
subroutine green_soylent (blb)
type(t_bloubs), intent (inout) :: blb
if (blb%age .gt. 5) then
if (blb%age .gt. 8) then
blb%alive = .FALSE.
endif
end subroutine

View File

@ -10,7 +10,7 @@ program essai
call init_random_seed()
somme = 0.0
do foo=1, 200000
do foo=1, 5
quux = rand()
somme = somme + quux
print *, foo, quux, somme/foo

View File

@ -17,8 +17,8 @@ module mathstuff
write(0, '(A,3I3,A,I6)') "sranding: ", tarray, " --> ", t3
call srand(t3)
! after initializing the random generator,
! you MUST use it for initializin the initialier
! after initializing the random generator engine,
! you MUST use it for initializing the initializer
dummy = rand()
end subroutine

View File

@ -3,7 +3,7 @@ program mergebloubs
use bloubspace
implicit none
integer, parameter :: NB_MAX_BLOUBS = 20000
integer, parameter :: NB_MAX_BLOUBS = 25000
character(200) :: infile, outfile
type(t_bloubs) :: bloub, newbloub

View File

@ -12,7 +12,7 @@ program movebloubs
type(t_bloubs) :: bloub
double precision :: bx, by, bz
! logical :: add_new_bloub = .TRUE.
! real :: rnd
real :: rnd
call init_random_seed()
@ -56,6 +56,9 @@ program movebloubs
! moving and boundingboxing
call move_bloub (bloub, 0.14)
call bound_a_blob (bloub)
if (bloub%radius .GT. 0.052) then
bloub%radius = bloub%radius * 0.985
endif
call green_soylent (bloub)
if (.NOT. bloub%alive) then
! write(0, '(A)') " KILL!"
@ -73,21 +76,25 @@ program movebloubs
endif
compteur = compteur + 1
enddo
enddo ! end of main loop
write(0, '(I5,1X,A)') compteur, "bloubs processed"
! ok, we have read all the bloubs in the input file
! insert some fancy conditional here
if (compteur .LT. 1600) then
if (rand() .LT. 0.05) then
call add_more_bloubs(outu, 8, 0.052)
rnd = rand()
write (0, '(A,1X,F5.3)') "try to add bloubs, rnd is", rnd
if (rnd .LT. 0.02) then
call add_more_bloubs(outu, 12, 0.210)
endif
endif
close(inu) ; close(outu)
if (killed .GT. 0) then
write (0, '(I5, A)') killed, " bloubs killed"
write (0, '(I5,A)') killed, " bloubs killed"
endif
bx = bx / dble(compteur)

View File

@ -5,9 +5,9 @@
#
INCFILE="bloubs.inc"
INCFILE="WS/bloubs.inc"
TMPPNG="/dev/shm/bloubs7.png"
POVOPT="+Q9 +a -v -d -W960 -H640 -WT2"
POVOPT="+Q9 +a -v -d -W1024 -H768 -WT2"
DDIR="frames"
LOGERR="log.error"
@ -15,7 +15,7 @@ LOGERR="log.error"
BLBS_IN="/dev/shm/in.blbs"
BLBS_OUT="/dev/shm/out.blbs"
NBIMG=1200
NBIMG=1800
make all
err=$?
@ -24,13 +24,13 @@ if [ $err -ne 0 ] ; then
exit 1
fi
printf "\n#declare NbImg = %d;\n" $NBIMG > nbimg.inc
printf "\n#declare NbImg = %d;\n" $NBIMG > WS/nbimg.inc
#
# first, we have to make a seminal buch of bloubs
# --> this function need to be parametrizable
#
./genbloubs ${BLBS_IN} 100
./genbloubs ${BLBS_IN} 15
for idx in $(seq 0 $NBIMG)
do
@ -49,16 +49,22 @@ do
td=$(date +'%F %R:%S')
hi=$(printf "#%05d" $idx)
count=$(head -1 "WS/log.nb_bloubs")
PNG=$(printf "%s/%05d.png" ${DDIR} $idx)
convert ${TMPPNG} \
-font Courier-Bold \
-pointsize 22 \
-pointsize 16 \
-fill Orange \
-gravity south-east \
-annotate +15+10 "$td" \
-gravity south-west \
-annotate +15+10 "$hi" \
-fill Yellow \
-pointsize 32 \
-gravity north-east \
-annotate +15+10 "$count" \
$PNG
echo $PNG '[done]'
@ -67,7 +73,7 @@ do
mv ${BLBS_OUT} ${BLBS_IN}
echo
sleep 9
sleep 15
done

View File

@ -11,13 +11,18 @@ global_settings {
#include "colors.inc"
#include "nbimg.inc"
#include "WS/nbimg.inc"
#declare NormClock = clock / NbImg;
// ----------------------------------------------------------
#include "bloubs.inc"
#include "WS/bloubs.inc"
#fopen LC "WS/log.nb_bloubs" write
#write (LC, Nb_Bloubs, "\n")
#fclose LC
object {
Bloubs
@ -27,8 +32,8 @@ object {
plane {
<0, 1, 0>, 0
texture {
pigment { color Gray05 }
finish { phong 0.18 metallic 0.45 }
pigment { color srgb <0.133, 0.144, 0.111> }
finish { phong 0.18 metallic 0.55 }
}
}
@ -49,7 +54,7 @@ merge {
#declare Un_Cadre = object
{
merge {
#local Ruc = BR * 0.78;
#local Ruc = BR * 0.666;
cylinder { <-BH, 0, -BH>, <-BH, 0, BH>, Ruc }
cylinder { < BH, 0, -BH>, < BH, 0, BH>, BR }
cylinder { < BH, 0, -BH>, <-BH, 0, -BH>, BR }
@ -100,16 +105,19 @@ union {
light_source { <9, 22, -17> color Gray80 }
light_source { <11, 19, 9> color Gray60 }
#declare XCAM = 8 -( NormClock*3 );
#declare YCAM = 5 + (11 * NormClock);
#declare XCAM = 8 - ( 8 * NormClock);
#declare YCAM = 5 + ( 6 * NormClock);
#declare ZCAM = -17;
#fopen LC "log.camera" append
/*
#fopen LC "WS/log.camera" append
#write (LC, clock, " ", NormClock, " ", YCAM, "\n")
#fclose LC
*/
camera {
location <XCAM, YCAM, -16>
look_at <0, 1, 0>
location <XCAM, YCAM, ZCAM>
look_at <0, 1.5, 0>
right x*image_width/image_height
angle 48
angle 42
}