Compare commits

..

No commits in common. "11d1cfd7deb861696d019582367ef3b2464c5013" and "87191666b4659ddb5d13d9899048a9bc2d6a7a20" have entirely different histories.

17 changed files with 50 additions and 118 deletions

View File

@ -1,9 +0,0 @@
all: single_function.o single_subroutine.o
single_function.o: single_function.c Makefile
gcc -Wall -g -c $<
single_subroutine.o: single_subroutine.c Makefile
gcc -Wall -g -c $<

View File

@ -1,6 +0,0 @@
`Sat Feb 11 15:46:25 UTC 2023`
Il serait temps de s'y mettre.

View File

@ -1,10 +0,0 @@
#include <stdio.h>
long tth_getpid(int option)
{
fprintf(stderr, ">>> %s ( %d )\n", __func__, option);
return 42L;
}

View File

@ -1,9 +0,0 @@
#include <stdio.h>
void tth_dumpmem(int option, void *ptr)
{
fprintf(stderr, ">>> %s ( %d %p )\n", __func__, option, ptr);
/* It's a subroutine so NO return */
}

View File

@ -1,7 +1,6 @@
essai essai
animation animation
realdump2png
WS/*.pgm WS/*.pgm
WS/*.png WS/*.png

View File

@ -5,7 +5,7 @@
GFOPT = -Wall -Wextra -g -time -I../Modules GFOPT = -Wall -Wextra -g -time -I../Modules
MODOBJ = ../Modules/spitpgm.o ../Modules/pixrgb.o MODOBJ = ../Modules/spitpgm.o ../Modules/pixrgb.o
all: essai animation realdump2png all: essai animation
# ----------- modules # ----------- modules
@ -20,7 +20,4 @@ essai: essai.f90 Makefile realfield.o
animation: animation.f90 Makefile realfield.o animation: animation.f90 Makefile realfield.o
gfortran $(GFOPT) $< realfield.o $(MODOBJ) -o $@ gfortran $(GFOPT) $< realfield.o $(MODOBJ) -o $@
realdump2png: realdump2png.f90 Makefile realfield.o #-
gfortran $(GFOPT) $< realfield.o $(MODOBJ) -o $@
#- remember bro: yolo forever :)

View File

@ -0,0 +1,2 @@
# placeholder

View File

@ -0,0 +1,2 @@
# placeholder

View File

@ -0,0 +1,2 @@
# placeholder

View File

@ -13,16 +13,18 @@ program animation
implicit none implicit none
! some configuration constants ! some configuration constants
integer, parameter :: S_WIDTH = 2048 integer, parameter :: S_WIDTH = 1024
integer, parameter :: S_HEIGHT = 2048 integer, parameter :: S_HEIGHT = 1024
integer, parameter :: NB_BODY = 250 integer, parameter :: NB_BODY = 51
!!! WARNING : global variable !!! !!! WARNING : global variable !!!
type(massbody) :: planets(NB_BODY) type(massbody) :: planets(NB_BODY)
call init_random() call init_random()
call create_some_planets(planets, 1664e3, S_WIDTH , S_HEIGHT) call create_some_planets(planets, 1664e3, S_WIDTH , S_HEIGHT)
call print_barycentre_bodies(planets, 'begin') call print_barycentre_bodies(planets)
! STOP 'BEFORE CRASH'
call la_grande_boucle(0, 2000, planets) call la_grande_boucle(0, 2000, planets)
@ -31,7 +33,7 @@ program animation
!----------------------------------------------------------------------- !-----------------------------------------------------------------------
contains contains
!- !-
! fabrication de la sequence complete ! fabrication d'une de la sequence complete
!- !-
subroutine la_grande_boucle(start, nbre, moons) subroutine la_grande_boucle(start, nbre, moons)
integer, intent(in) :: start, nbre integer, intent(in) :: start, nbre
@ -45,21 +47,19 @@ subroutine la_grande_boucle(start, nbre, moons)
! else use ?????ing ! else use ?????ing
call deplace_les_planetes(moons, .TRUE.) call deplace_les_planetes(moons, .TRUE.)
! computing the field (used as a HF in Povray
write (filename, "(a, i5.5, a)") 'WS/nanim/', pass, '.pgm' write (filename, "(a, i5.5, a)") 'WS/nanim/', pass, '.pgm'
write(0, '(3I5, " * ", a20)') start, nbre, pass, filename write(0, '(3I5, " * ", a20)') start, nbre, pass, filename
call build_and_write_a_field(S_WIDTH, S_HEIGHT, moons, filename) call build_and_write_a_field(S_WIDTH, S_HEIGHT, moons, filename)
! save the current bodies positions (can be used in gnuplot) write (filename, "(a, i5.5, a)") 'WS/data/', pass, '.txt'
! write (filename, "(a, i5.5, a)") 'WS/data/', pass, '.txt' call save_bodies_to_txt_file (planets, filename)
! call save_bodies_to_txt_file (planets, filename)
write (filename, "(a, i5.5, a)") 'WS/colmap/', pass, '.pnm' write (filename, "(a, i5.5, a)") 'WS/colmap/', pass, '.pnm'
call make_color_map(planets, filename, S_WIDTH, S_HEIGHT) call make_color_map(planets, filename, S_WIDTH, S_HEIGHT)
enddo enddo
call print_barycentre_bodies(moons, 'end') call print_barycentre_bodies(moons)
end subroutine end subroutine
@ -107,14 +107,14 @@ subroutine make_color_map(moons, fname, width, height)
endif endif
end do ! loop on all the moons, ipl index end do ! loop on all the moons, ipl index
cmap(ix, iy)%r = mod(near*3, 255) cmap(ix, iy)%r = mod(near*13, 255)
cmap(ix, iy)%g = mod(near*4, 255) cmap(ix, iy)%g = mod(near*14, 255)
cmap(ix, iy)%b = mod(near*5, 255) cmap(ix, iy)%b = mod(near*15, 255)
enddo enddo
enddo enddo
call rgbpix_spit_as_pnm_8(cmap, fname) call rgbpix_spit_as_pnm(cmap, fname)
deallocate(cmap) deallocate(cmap)
@ -131,9 +131,9 @@ subroutine deplace_les_planetes(moons, clipit)
logical, intent(in) :: clipit logical, intent(in) :: clipit
integer :: foo integer :: foo
real :: depx, depy, coef real :: depx, depy
integer, parameter :: EE = 100 integer, parameter :: EE = 51
integer :: SW = S_WIDTH - EE integer :: SW = S_WIDTH - EE
integer :: SH = S_HEIGHT - EE integer :: SH = S_HEIGHT - EE
@ -162,12 +162,7 @@ subroutine deplace_les_planetes(moons, clipit)
if (moons(foo)%posy .LT. EE) moons(foo)%posy = SH if (moons(foo)%posy .LT. EE) moons(foo)%posy = SH
endif endif
if (rand() .LT. 0.15) then moons(foo)%heading = moons(foo)%heading + (0.78*(rand()-0.50))
coef = 1.63
else
coef = 0.78
endif
moons(foo)%heading = moons(foo)%heading + (coef*(rand()-0.42))
if (moons(foo)%heading .GT. 6.283185307) moons(foo)%heading = 0.0 if (moons(foo)%heading .GT. 6.283185307) moons(foo)%heading = 0.0
if (moons(foo)%heading .LT. 0.000000001) moons(foo)%heading = 0.0 if (moons(foo)%heading .LT. 0.000000001) moons(foo)%heading = 0.0

View File

@ -23,7 +23,7 @@ echo "file type :" $filetype
case $filetype in case $filetype in
PNG) extension=".png" ;; PNG) extension=".png" ;;
Netpbm) extension=".pgm" ;; Netpbm) extension=".pgm" ;;
*) extension=".pnm" ;; *) extension=".binary" ;;
esac esac
echo "extension :" $extension echo "extension :" $extension

View File

@ -12,7 +12,7 @@ program essai
call init_random() call init_random()
call essai_near_planet(2048, 2048) call essai_near_planet(1024, 1024)
STOP 'BECAUSE YOLO' STOP 'BECAUSE YOLO'
@ -74,7 +74,7 @@ subroutine essai_near_planet(nbplanets, szfield)
enddo enddo
call rgbpix_spit_as_pnm_8(cmap, "rgb.pnm") call rgbpix_spit_as_pnm(cmap, "rgb.pnm")
end subroutine end subroutine
!----------------------------------------------------------------------- !-----------------------------------------------------------------------

View File

@ -2,7 +2,7 @@
set -e set -e
POVOPT=" -q9 +a -W1280 -H1024 +WT2 -d -v " POVOPT=" -q9 +a -W1024 -H768 +WT2 -d -v "
SOURCE="vision.pov" SOURCE="vision.pov"
TMPF="/dev/shm/gravfield.png" TMPF="/dev/shm/gravfield.png"
@ -29,12 +29,10 @@ convert ${TMPF} \
-fill Orange \ -fill Orange \
-annotate +15+22 "$timestamp" \ -annotate +15+22 "$timestamp" \
-annotate +15+48 "$texte" \ -annotate +15+48 "$texte" \
-pointsize 14 \ -pointsize 16 \
-gravity south-west \ -gravity south-west \
-annotate +15+9 "tTh & Konrad" \ -annotate +15+9 "tTh & Konrad" \
${outfile} ${outfile}
sleep 3
} }
# --------------------------------------- # ---------------------------------------
@ -53,6 +51,5 @@ ffmpeg -nostdin \
-metadata artist='---{ tTh and Konrad }---' \ -metadata artist='---{ tTh and Konrad }---' \
-metadata title="Experiment on Gravity Field" \ -metadata title="Experiment on Gravity Field" \
-c:v libx264 -pix_fmt yuv420p \ -c:v libx264 -pix_fmt yuv420p \
-preset veryslow \ bar.mp4
gravity-field.mp4

View File

@ -1,23 +0,0 @@
!-----------------------------------------------------------------------
!-
! convertir un dum de champ de reel en .PNG
! nouveau 17 decembre 2022
!-
!-----------------------------------------------------------------------
program realdump2png
use realfield
implicit none
stop "BECAUSE I'M TIRED *NOW*"
contains
!-----------------------------------------------------------------------
subroutine load_a_dump_file(fname, location)
character(len=*), intent(in) :: fname
real, dimension(:,:), intent(inout) :: location
end subroutine
!-----------------------------------------------------------------------
end program
!-----------------------------------------------------------------------

View File

@ -29,7 +29,7 @@ subroutine compute_barycentre_bodies(astres, bcx, bcy)
integer :: foo integer :: foo
real :: cx, cy real :: cx, cy
! May be we have to use DOUBLE PRECSION here ? ! May be we have to use DOUBLE RPECSION here ?
cx = 0.0 cx = 0.0
cy = 0.0 cy = 0.0
do foo=1, ubound(astres, 1) do foo=1, ubound(astres, 1)
@ -40,13 +40,12 @@ subroutine compute_barycentre_bodies(astres, bcx, bcy)
bcy = cy / real(ubound(astres, 1)) bcy = cy / real(ubound(astres, 1))
end subroutine end subroutine
!----------------------------------------------------------------------- !-----------------------------------------------------------------------
subroutine print_barycentre_bodies(astres, title) subroutine print_barycentre_bodies(astres)
type(massbody), intent(in) :: astres(:) type(massbody), intent(in) :: astres(:)
character(len=*), intent(in) :: title
real :: cx, cy real :: cx, cy
call compute_barycentre_bodies(astres, cx, cy) call compute_barycentre_bodies(astres, cx, cy)
print *, "barycentre {", title, "} ", cx, cy print *, "barycentre : ", cx, cy
end subroutine end subroutine
!----------------------------------------------------------------------- !-----------------------------------------------------------------------
@ -82,8 +81,8 @@ subroutine create_some_planets(planets, coef, sx, sy)
!- !-
planets(foo)%posx = rand() * real(sx-1) planets(foo)%posx = rand() * real(sx-1)
planets(foo)%posy = rand() * real(sy-1) planets(foo)%posy = rand() * real(sy-1)
planets(foo)%mass = 7.12e6 + coef*foo planets(foo)%mass = 7e6 + coef*foo
planets(foo)%heading = 2 * 3.141592654 * rand() planets(foo)%heading = 2 * 3.14159 * rand()
if (rand() .LT. 0.15) planets(foo)%speed = 3.14159 if (rand() .LT. 0.15) planets(foo)%speed = 3.14159
planets(foo)%serial = foo*2 + 120 planets(foo)%serial = foo*2 + 120
endif endif

View File

@ -4,13 +4,9 @@ set -e # stop on error
make animation make animation
LOG="log.animation" date > animation.log
date >> $LOG time ./animation | tee animation.log
time ./animation | tee -a $LOG ./encode.sh WS/nanim/ quux.mp4
./encode.sh WS/colmap/ zzz.mp4
./encode.sh WS/nanim/ gravity-field.mp4
./encode.sh WS/colmap/ gravity-colmap.mp4
ls -rtl *.mp4 >> $LOG

View File

@ -45,7 +45,7 @@ texture {
} }
} }
object { GravityField scale <4.10, 0.60, 4.10> } object { GravityField scale <4, 0.60, 4> }
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
@ -58,13 +58,13 @@ merge {
XXX */ XXX */
light_source { < -2, 9.3, -7> color Gray90 } light_source { < -2, 9.3, -7> color Gray90 }
light_source { < -6, 9.3, -8> color Orange*0.65 } light_source { < -6, 9.3, -8> color Orange*0.75 }
light_source { < -15, 2.3, 17> color Gray70 } light_source { < -15, 2.3, 17> color Green*0.25 }
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
camera { camera {
location <-8, 4-(1.7*NormClock), -4 + (11.66*NormClock)> location <-8, 4-(1.5*NormClock), 1 + (5*NormClock)>
look_at <0, 0, 0> look_at <0, 0, 0>
right x*image_width/image_height right x*image_width/image_height
angle 33 angle 33