Compare commits

..

No commits in common. "7a6e5f1e27e0a2d663f3a7a6bc574f7167503ba0" and "5b6df523fc55abfd90fb342fb2545ec952c4019d" have entirely different histories.

9 changed files with 18 additions and 141 deletions

View File

@ -6,10 +6,7 @@ WS/*.pgm
WS/*.png
WS/*/*.pgm
WS/*/*.png
WS/*/*.gif
WS/data/*
*.png
*.gif
*.log
*.mp4

View File

@ -18,10 +18,6 @@ passer per une recompilation.
Vous vous en doutez, c'est du POVray.
## Sortie graphique
Actuellement, un script pour enrober gnuplot, what else ?
## Conclusion
Enjoy !

View File

@ -12,13 +12,13 @@ program animation
! some configuration constants
integer, parameter :: S_WIDTH = 1024
integer, parameter :: S_HEIGHT = 1024
integer, parameter :: NB_BODY = 70
integer, parameter :: NB_BODY = 82
!!! WARNING : global variable !!!
!!! WARNING : global variables !!!
type(massbody) :: planets(NB_BODY)
call init_random()
call create_some_planets(planets, 1664e3, S_WIDTH , S_HEIGHT)
call create_some_planets(planets, 1337e3, S_WIDTH , S_HEIGHT)
call print_barycentre_bodies(planets)
! STOP 'BEFORE CRASH'
@ -47,10 +47,6 @@ subroutine la_grande_boucle(start, nbre, moons)
write (filename, "(a, i5.5, a)") 'WS/nanim/', pass, '.pgm'
write(0, '(3I5, " * ", a20)') start, nbre, pass, filename
call build_and_write_a_field(S_WIDTH, S_HEIGHT, moons, filename)
write (filename, "(a, i5.5, a)") 'WS/data/', pass, '.txt'
call save_bodies_to_txt_file (planets, filename)
enddo
call print_barycentre_bodies(moons)
@ -100,7 +96,7 @@ subroutine deplace_les_planetes(moons, clipit)
if (moons(foo)%posy .LT. EE) moons(foo)%posy = SH
endif
moons(foo)%heading = moons(foo)%heading + (0.71*(rand()-0.50))
moons(foo)%heading = moons(foo)%heading + (0.25*(rand()-0.499999))
if (moons(foo)%heading .GT. 6.2831853) moons(foo)%heading = 0.0
if (moons(foo)%heading .LT. 0.0000001) moons(foo)%heading = 0.0

View File

@ -1,42 +0,0 @@
#!/bin/bash
set -e
SRC=WS/data/00013.txt
DST=graph.png
rm WS/graph/*.png
# ----------------------------------------------------------
plot_a_map ()
{
NUMERO=$1
SRC=$(printf "WS/data/%05d.txt" $NUMERO)
DST=$(printf "WS/graph/%05d.png" $NUMERO)
TXT=$(printf "Mass bodies #%05d" $NUMERO)
echo " " $SRC $DST " " $TXT
gnuplot << __EOC__
set term png size 512,512
set xrange [ 0.0 : 1024 ]
set yrange [ 0.0 : 1024 ]
set output "${DST}"
set ytics 256
set xtics 256
set grid front
set title "${TXT}"
plot "$SRC" using 1:2 title "location"
__EOC__
}
# ----------------------------------------------------------
for foo in $(seq 0 8 1999)
do
plot_a_map $foo
done
convert -delay 10 WS/graph/0????.png foo.gif
# ----------------------------------------------------------

View File

@ -4,21 +4,15 @@
# Makefile for the general purpose moduls
#
GFOPT = -Wall -Wextra -time -g
all: chkpixels
GFOPT = -Wall -Wextra -time -g -O
spitpgm.o: spitpgm.f90 Makefile
gfortran $(GFOPT) -c $< -o $@
trials.o: trials.f90 Makefile
gfortran $(GFOPT) -c $< -o $@
#
# programmes de testouille
#
chkpixels: chkpixels.f90 Makefile trials.o spitpgm.o
gfortran $(GFOPT) $< spitpgm.o trials.o -o $@
chkpixels: chkpixels.f90 Makefile spitpgm.o
gfortran $(GFOPT) $< spitpgm.o -o $@

View File

@ -1,10 +1,4 @@
# General purpose modules
## spitpgm
Write gray level 2d buffer (aka picture) to disk in the NetPNM format.
## trials
Experimental WIPs from hell.
* spitpgm

View File

@ -1,25 +1,20 @@
!-------------------------------------------------------------------
!-
program chkpixels
use spitpgm ! main module
use trials ! experiments, ymmv.
use spitpgm
implicit none
write(0, *) "------ CHKPIXELS ------"
call test_alpha(3)
call test_alpha()
STOP 'BECAUSE NO CPU AVAILABLE'
contains
!-------------------------------------------------------------------
!-
subroutine test_alpha(increment)
integer, intent(in) :: increment
subroutine test_alpha()
integer, parameter :: SZ = 40
integer, parameter :: SZ = 32
integer, dimension(SZ, SZ) :: greymap
integer :: ix, iy, value
@ -27,14 +22,12 @@ contains
do iy=1, SZ
do ix=1, SZ
greymap(ix, iy) = value
value = value + increment
value = value + 1
enddo
enddo
call spit_as_pgm_16 (greymap, 'a.pgm')
call spit_as_pgm_eq (greymap, 'b.pgm')
call spit_as_pgm_8 (greymap, 'c.pgm')
call new_spit_a (greymap, 'x.pgm')
end subroutine

View File

@ -8,9 +8,8 @@ module spitpgm
!-------------------------------------------------------------------
!-
! This subroutine try to scale the values to fit the 16 bit range.
! XXX may be add a third parameter : the max value required ?
!-
! This subroutine try to scale the values to fit the 16 bit range
!
subroutine spit_as_pgm_eq(pic, fname)
integer, intent(in), dimension (:,:) :: pic
@ -20,7 +19,7 @@ subroutine spit_as_pgm_eq(pic, fname)
integer :: ix, iy
real :: fk, fpix
! write(0, '(1X, A)') " spit_as_pgm_eq to " // trim(fname)
write(0, '(1X, A)') "> spit_as_pgm_eq to " // trim(fname)
open(newunit=io, file=fname)
write (io, '(a2)') "P2"
@ -35,7 +34,7 @@ subroutine spit_as_pgm_eq(pic, fname)
enddo
else
fk = float(foo) / 65535.01
! write (0, *) " max pix value", foo, " fk ", fk
write (0, *) " max pix value", foo, " fk ", fk
do iy = 1, ubound(pic, 2)
do ix = 1, ubound(pic, 1)
fpix = float(pic(ix, iy)) / fk
@ -49,7 +48,6 @@ end subroutine
!-------------------------------------------------------------------
!-
! 16 bits - 65535 levels portable grey map file
! no data conversion except upper clippin.
!-
subroutine spit_as_pgm_16(pic, fname)
integer, intent(in), dimension (:,:) :: pic

View File

@ -1,49 +0,0 @@
!-
! This module try to write PNM complient files - ymmv
!-
module trials
implicit none
contains
!-------------------------------------------------------------------
subroutine new_spit_a(pic, fname)
integer, intent(in), dimension (:,:) :: pic
character (len=*), intent(in) :: fname
integer :: foo, io, ix, iy
integer :: buffer(8), ptr
! print *, "newspit a, largeur ", size(pic, 1), ubound(pic, 1)
! print *, "newspit a, hauteur ", size(pic, 2), ubound(pic, 2)
! print *, "newspit a, buffer ", size(buffer, 1)
open(newunit=io, file=fname)
write (io, '(a2)') "P2"
write (io, '("# new_spit_a")')
write (io, '(i0," ",i0)') size(pic, 1), size(pic, 2)
write (io, '(i0)') 65535
buffer = 0
ptr = 1
do iy=1, ubound(pic, 2)
do ix=1, ubound(pic, 1)
foo = pic(ix, iy)
if (foo .GT. 65535) foo = 65535
buffer(ptr) = foo
ptr = ptr + 1
if (ptr .EQ. size(buffer, 1)+1) then
write(io, "(8(' ',i0))") buffer
ptr = 1
endif
enddo
enddo
close(io)
end subroutine
!-------------------------------------------------------------------
end module