Compare commits
35 Commits
5b525f5949
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c187e01bc | ||
|
|
caec2e08fe | ||
|
|
d76861a4e4 | ||
|
|
764d7343f2 | ||
|
|
dd552abeda | ||
|
|
27635a0398 | ||
|
|
eef8e7db64 | ||
|
|
09a4cb7cff | ||
|
|
f039df4fe2 | ||
|
|
e3ff6de512 | ||
|
|
cd715e902f | ||
|
|
49183e4153 | ||
|
|
3da1022e8f | ||
|
|
c32db90e10 | ||
|
|
d1b7218b21 | ||
|
|
7d0e302e09 | ||
|
|
ab23dc9897 | ||
|
|
ca899f5e90 | ||
|
|
72f59b96e5 | ||
|
|
98350ed6c6 | ||
|
|
a8021a5713 | ||
|
|
c16269f4e8 | ||
|
|
4f11c0e36a | ||
|
|
cebe61b69b | ||
|
|
6eac66c818 | ||
|
|
ad82a68039 | ||
|
|
da681c3455 | ||
|
|
d2572ec80d | ||
|
|
5153e8437c | ||
|
|
f9a93bf6f4 | ||
|
|
5030fda56f | ||
|
|
329f054fff | ||
|
|
1552320558 | ||
|
|
87645472b4 | ||
|
|
7bf219d77c |
3
BloubWorld/.gitignore
vendored
3
BloubWorld/.gitignore
vendored
@@ -7,6 +7,8 @@ nbimg.inc
|
||||
*.mp4
|
||||
*.lst
|
||||
*.wav
|
||||
*.xyz
|
||||
*.ssv
|
||||
frames/*
|
||||
log.*
|
||||
|
||||
@@ -17,4 +19,5 @@ mergebloubs
|
||||
listbloubs
|
||||
essai
|
||||
|
||||
WS/*.data
|
||||
core
|
||||
|
||||
@@ -7,13 +7,13 @@ all: genbloubs movebloubs exportbloubs mergebloubs \
|
||||
# ------------------------------------------------------------
|
||||
|
||||
GFOPT = -Wall -Wextra -g -time -I../Modules
|
||||
OBJS = bloubspace.o povstuff.o mathstuff.o
|
||||
OBJS = bloubspace.o povstuff.o
|
||||
MYLIB = '../Modules/libtth90modules.a'
|
||||
|
||||
# ------------------------------------------------------------
|
||||
|
||||
essai: essai.f90 Makefile $(OBJS)
|
||||
gfortran $(GFOPT) $< $(OBJS) -o $@
|
||||
gfortran $(GFOPT) $< $(OBJS) $(MYLIB) -o $@
|
||||
|
||||
# ------------------------------------------------------------
|
||||
|
||||
@@ -37,25 +37,22 @@ bloubspace.o: bloubspace.f90 Makefile
|
||||
povstuff.o: povstuff.f90 Makefile
|
||||
gfortran $(GFOPT) -c $<
|
||||
|
||||
mathstuff.o: mathstuff.f90 Makefile
|
||||
gfortran $(GFOPT) -c $<
|
||||
|
||||
# ------------------------------------------------------------
|
||||
|
||||
genbloubs: genbloubs.f90 Makefile $(OBJS)
|
||||
gfortran $(GFOPT) $< $(OBJS) $(MYLIB) -o $@
|
||||
|
||||
movebloubs: movebloubs.f90 Makefile $(OBJS)
|
||||
gfortran $(GFOPT) $< $(OBJS) -o $@
|
||||
gfortran $(GFOPT) $< $(OBJS) $(MYLIB) -o $@
|
||||
|
||||
listbloubs: listbloubs.f90 Makefile $(OBJS)
|
||||
gfortran $(GFOPT) $< $(OBJS) -o $@
|
||||
gfortran $(GFOPT) $< $(OBJS) $(MYLIB) -o $@
|
||||
|
||||
exportbloubs: exportbloubs.f90 Makefile $(OBJS)
|
||||
gfortran $(GFOPT) $< $(OBJS) -o $@
|
||||
gfortran $(GFOPT) $< $(OBJS) $(MYLIB) -o $@
|
||||
|
||||
mergebloubs: mergebloubs.f90 Makefile $(OBJS)
|
||||
gfortran $(GFOPT) $< $(OBJS) -o $@
|
||||
gfortran $(GFOPT) $< $(OBJS) $(MYLIB) -o $@
|
||||
|
||||
# ------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -41,17 +41,25 @@ Fabrication d'une population de bloubs plus ou moins aléatoires.
|
||||
Deux paramètres : le nom du fichier (extention `.blbs`)
|
||||
et le nombre de bloubs désirés.
|
||||
Les règles de génération *devraient* être paramétrables.
|
||||
[source](genbloubs.f90)
|
||||
([source](genbloubs.f90))
|
||||
|
||||
### movebloubs
|
||||
|
||||
Le cœur actif du système : c'est lui qui, à chaque tick, va déplacer
|
||||
les bloubs, gérer les rebonds avec la boudary-box, éliminer les
|
||||
bloubs usés par les chocs, et faire naitre de nouveaux bloubs
|
||||
Il ne fait que deux choses : à chaque tick, va déplacer
|
||||
les bloubs et faire naitre de nouveaux bloubs
|
||||
si le besoin s'en fait sentir.
|
||||
Seul problème, il n'a pas de notion directe du temps, parce qu'il est juste de passage dans un pipeline.
|
||||
[source](movebloubs.f90)
|
||||
([source](movebloubs.f90))
|
||||
|
||||
### mergebloubs
|
||||
|
||||
Le cœur actif du système : c'est lui qui, à chaque tick, va
|
||||
gérer les rebonds avec la boudary-box, éliminer les
|
||||
bloubs usés par les chocs, gérer les fusions de bloubs
|
||||
(avec plein de mathstuff dedans) et assurer l'équilibre
|
||||
global du système...
|
||||
C'est sur cette partie qu'il y a des améliorations à trouver.
|
||||
([source](mergebloubs.f90))
|
||||
|
||||
### exportbloubs
|
||||
|
||||
@@ -60,15 +68,13 @@ 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.
|
||||
**Le format de sortie est susceptible de changer sans préavis.**
|
||||
Bon, pour le moment, dans les formats il n'y a que POVray,
|
||||
mais Gnuplot et/ou Rdata arriveront bien un de ces jours.[source](exportbloubs.f90)
|
||||
mais Gnuplot et/ou Rdata arriveront bien un de ces jours.
|
||||
([source](exportbloubs.f90))
|
||||
|
||||
|
||||
|
||||
### mergebloubs
|
||||
|
||||
Alors, celui-ci, il n'est pas vraiment au point. Il faut tout ré-écrire
|
||||
et faire gaffe à l'explosion quadratique.
|
||||
[source](mergebloubs.f90)
|
||||
Un exemple : l'idée est de générer un fichier `.inc` pour
|
||||
Povray pour utiliser les données exportées dans une scène,
|
||||
par exemple le barycentre des bloubs. Et c'est très facile
|
||||
à faire avec un [script Awk](toinc.awk).
|
||||
|
||||
## TODO
|
||||
|
||||
|
||||
@@ -31,6 +31,8 @@ module bloubspace
|
||||
! ----------------------------------------------------------------
|
||||
|
||||
subroutine load_boundingbox(infile, where, name)
|
||||
implicit none
|
||||
|
||||
character(*), intent(in) :: infile
|
||||
type(t_boundingbox), intent (out) :: where
|
||||
character(8), intent(in) :: name
|
||||
@@ -68,32 +70,44 @@ module bloubspace
|
||||
end subroutine load_boundingbox
|
||||
|
||||
! ----------------------------------------------------------------
|
||||
|
||||
subroutine make_a_random_bloub(blb)
|
||||
!-
|
||||
! coefxyz :
|
||||
! dispersion de la position autour de l'origine
|
||||
!-
|
||||
subroutine make_a_random_bloub(blb, coefxyz)
|
||||
implicit none
|
||||
type(t_bloubs), intent (out) :: blb
|
||||
real, intent(in) :: coefxyz
|
||||
|
||||
blb%px = 3.57 * (rand() - 0.50)
|
||||
blb%py = 2.66 * (rand() - 0.50)
|
||||
blb%pz = 3.57 * (rand() - 0.50)
|
||||
! write(0, *) "coef xyz = ", coefxyz
|
||||
blb%px = coefxyz * (rand() - 0.50)
|
||||
blb%py = coefxyz * (rand() - 0.50)
|
||||
blb%pz = coefxyz * (rand() - 0.50)
|
||||
|
||||
blb%vx = (rand()) / 2.500
|
||||
if (blb%px .LT. 0.0) blb%vx = -blb%vx
|
||||
blb%vx = (rand() / 9.000)
|
||||
! if (blb%px .LT. 0.0) blb%vx = -blb%vx
|
||||
|
||||
blb%vy = (rand()) / 4.000
|
||||
if (blb%py .LT. 0.0) blb%vy = -blb%vx
|
||||
blb%vy = -0.10 + (rand() / 11.000)
|
||||
! if (blb%py .LT. 0.0) blb%vy = -blb%vy
|
||||
|
||||
blb%vz = (rand()) / 2.500
|
||||
if (blb%pz .LT. 0.0) blb%vz = -blb%vz
|
||||
blb%vz = (rand() / 10.000)
|
||||
! if (blb%pz .LT. 0.0) blb%vz = -blb%vz
|
||||
|
||||
blb%red = mod(irand(), 256)
|
||||
blb%green = 127 + mod(irand(), 127)
|
||||
blb%blue = mod(irand(), 256)
|
||||
|
||||
blb%state = 0
|
||||
blb%alive = .TRUE.
|
||||
blb%age = 0
|
||||
blb%agemax = 300
|
||||
blb%agemax = 250 + mod(irand(), 250)
|
||||
|
||||
end subroutine
|
||||
! ----------------------------------------------------------------
|
||||
! Load a blbs file into an array of bloubs
|
||||
|
||||
subroutine spit_bloubs_to_file (fname, blbarray, towrite)
|
||||
implicit none
|
||||
character(*), intent(in) :: fname
|
||||
type(t_bloubs), dimension(:) :: blbarray
|
||||
integer, intent(in) :: towrite
|
||||
@@ -101,8 +115,8 @@ module bloubspace
|
||||
integer :: errcode, output, foo, spitted
|
||||
character(200) :: chaine
|
||||
|
||||
write (0, '(" spitting", (I6), " bloubs to ", (A), " file")') &
|
||||
towrite, trim(fname)
|
||||
! write (0, '(" spitting", (I6), " bloubs to ", (A), " file")') &
|
||||
! towrite, trim(fname)
|
||||
|
||||
open( newunit=output, &
|
||||
file=trim(fname), form='unformatted', &
|
||||
@@ -125,13 +139,15 @@ module bloubspace
|
||||
enddo
|
||||
|
||||
close(output)
|
||||
write(0, '(1X, "spitted ", I6, " bloubs")') spitted
|
||||
write(0, '(1X, "spitted ", I0, " bloubs to ", A)') &
|
||||
spitted, trim(fname)
|
||||
|
||||
end subroutine spit_bloubs_to_file
|
||||
! ----------------------------------------------------------------
|
||||
! Dump an array of bloubs to a blbs file.
|
||||
!
|
||||
subroutine slurp_bloubs_file_in_array (infile, blbarray, nbread)
|
||||
implicit none
|
||||
character(*), intent(in) :: infile
|
||||
type(t_bloubs), dimension(:), intent(out) :: blbarray
|
||||
integer, intent(out) :: nbread
|
||||
@@ -160,7 +176,7 @@ module bloubspace
|
||||
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
|
||||
! write(0, '("errcode on read ", (I0,1X,A))') errcode, chaine
|
||||
exit
|
||||
endif
|
||||
nbread = nbread + 1
|
||||
@@ -182,6 +198,7 @@ module bloubspace
|
||||
! Display a bloub content to stderr
|
||||
|
||||
subroutine display_bloub (blb, message)
|
||||
implicit none
|
||||
type(t_bloubs), intent (in) :: blb
|
||||
character(*), intent (in) :: message
|
||||
|
||||
@@ -201,8 +218,11 @@ module bloubspace
|
||||
|
||||
end subroutine
|
||||
! ----------------------------------------------------------------
|
||||
|
||||
!-
|
||||
! Deplacement d'un bloub
|
||||
!-
|
||||
subroutine move_bloub (blb, coef)
|
||||
implicit none
|
||||
type(t_bloubs), intent (inout) :: blb
|
||||
real, intent (in) :: coef
|
||||
|
||||
@@ -211,58 +231,78 @@ module bloubspace
|
||||
blb%py = blb%py + (blb%vy * coef)
|
||||
blb%pz = blb%pz + (blb%vz * coef)
|
||||
|
||||
! faire vieillir le bloub
|
||||
blb%age = blb%age + 1
|
||||
|
||||
end subroutine
|
||||
! ----------------------------------------------------------------
|
||||
!
|
||||
! detection des collisions avec les parois de la boite
|
||||
! laquelle boite gagnerais beaucoup a etre parametrable.
|
||||
! laquelle boite gagnerais beaucoup a etre parametrable,
|
||||
! ainsi qu'un éventuel coefficient de réduction de la
|
||||
! vitesse. XXX
|
||||
!
|
||||
subroutine bound_a_bloub (blb)
|
||||
implicit none
|
||||
type(t_bloubs), intent (inout) :: blb
|
||||
|
||||
real, parameter :: SH = 6.0
|
||||
real, parameter :: SV = 4.0
|
||||
real, parameter :: SV = 6.0
|
||||
|
||||
logical :: flag
|
||||
|
||||
flag = .FALSE.
|
||||
|
||||
! X axis
|
||||
if ((blb%px + blb%radius) .GT. SH) then
|
||||
blb%vx = -1.0 * blb%vx
|
||||
blb%px = SH- blb%radius
|
||||
blb%age = blb%age + 1
|
||||
blb%px = SH - blb%radius
|
||||
flag = .TRUE.
|
||||
endif
|
||||
if ((blb%px - blb%radius) .LT. -SH) then
|
||||
blb%vx = -1.0 * blb%vx
|
||||
blb%px = -SH + blb%radius
|
||||
blb%age = blb%age + 1
|
||||
flag = .TRUE.
|
||||
endif
|
||||
|
||||
! vertical axe Y
|
||||
if ((blb%py - blb%radius) .LT. -SV) then
|
||||
blb%vy = -1.0 * blb%vy
|
||||
blb%py = -SV + blb%radius
|
||||
blb%age = blb%age + 1
|
||||
flag = .TRUE.
|
||||
endif
|
||||
if ((blb%py + blb%radius) .GT. SV) then ! overshoot ?
|
||||
blb%vy = -1.0 * blb%vy
|
||||
blb%age = blb%age + 1
|
||||
blb%py = SV - blb%radius
|
||||
flag = .TRUE.
|
||||
endif
|
||||
|
||||
! Z axis
|
||||
if ((blb%pz + blb%radius) .GT. SH) then
|
||||
blb%vz = -1.0 * blb%vz
|
||||
blb%age = blb%age + 1
|
||||
blb%pz = SH - blb%radius
|
||||
flag = .TRUE.
|
||||
endif
|
||||
if ((blb%pz + blb%radius) .LT. -SH) then
|
||||
blb%vz = -1.0 * blb%vz
|
||||
blb%age = blb%age + 1
|
||||
blb%pz = -SH + blb%radius
|
||||
flag = .TRUE.
|
||||
endif
|
||||
|
||||
if (flag) then
|
||||
blb%age = blb%age + 1
|
||||
blb%radius = blb%radius * 0.9999
|
||||
endif
|
||||
|
||||
if (blb%age .GT. blb%agemax) then
|
||||
blb%alive = .FALSE.
|
||||
endif
|
||||
|
||||
end subroutine
|
||||
|
||||
! ----------------------------------------------------------------
|
||||
function distance_of_bloubs(bla, blb)
|
||||
implicit none
|
||||
type(t_bloubs), intent(in) :: bla, blb
|
||||
real :: distance_of_bloubs
|
||||
|
||||
@@ -280,15 +320,16 @@ module bloubspace
|
||||
! kill a bloub under condition(s)
|
||||
|
||||
subroutine green_soylent (blb)
|
||||
implicit none
|
||||
type(t_bloubs), intent (inout) :: blb
|
||||
|
||||
if (blb%age .gt. 24) then
|
||||
if (blb%age .gt. 240) then
|
||||
blb%alive = .FALSE.
|
||||
endif
|
||||
|
||||
! this is juste a molly-guard, don't worry
|
||||
!
|
||||
if (blb%radius .GT. 2.0) then
|
||||
if (blb%radius .GT. 5.0) then
|
||||
blb%alive = .FALSE.
|
||||
endif
|
||||
end subroutine
|
||||
|
||||
@@ -49,7 +49,7 @@ sur les trois directions de l'espace bloubeux.
|
||||
D'autres, comme `alive`, sont plus délicates à expliquer,
|
||||
sauf si l'on considère que les bloubs sont zombifiables.
|
||||
|
||||
D'autres, comme l'age et l'agemax, sont bien plus sujettes à de diverses
|
||||
D'autres, comme age et agemax, sont bien plus sujettes à de diverses
|
||||
interprétations. doit-on incrémenter l'age à chaque tick d'horloge
|
||||
ou à chaque évènement discret ? Et à quel age un bloub devient-il
|
||||
trop vieux, à quel age va-t-il mourir ?
|
||||
@@ -78,7 +78,23 @@ taille, densité, age et couleur qu'il y a des choses à faire.
|
||||
* Agemax : (maximum des deux agemaxs) - forfait
|
||||
* Couleurs : un système de mutation selon critères ?
|
||||
|
||||
Il ne reste qu'à coder tout ça.
|
||||
Il ne reste qu'à coder tout ça...
|
||||
|
||||
## Analyse de population
|
||||
|
||||
Nous avons des moyens assez simple d'enregistrer l'état complet
|
||||
de la population de bloubs à chaque itération.
|
||||
La meilleure preuve étant les vidéos publiés dans les peertubes.
|
||||
Mais nous devrions plus nous pencher sur les aspects statistiques,
|
||||
comme la démographie, l'état de santé, la pyramide des ages...
|
||||
|
||||
Les traitements simples peuvent faire appel à Awk et Gnuplot.
|
||||
Pour les visions plus avancées, un logiciel spécialisé sera
|
||||
le bienvenu, et **R** est un bon candidat potentiel.
|
||||
On peut aussi envisager la pureté du code Fortran,
|
||||
couplé avec un *toolkit* graphique comme XXX.
|
||||
|
||||
Il ne reste qu'à coder tout ça...
|
||||
|
||||
## Et pour la suite ?
|
||||
|
||||
|
||||
@@ -1,18 +1,10 @@
|
||||
program essai
|
||||
|
||||
use bloubspace
|
||||
use mathstuff
|
||||
! use bloubspace
|
||||
use mathstuff2
|
||||
implicit none
|
||||
|
||||
type(t_boundingbox) :: bbox
|
||||
|
||||
call load_boundingbox("WS/boundinboxes.dat", bbox, "cube ")
|
||||
|
||||
print *, bbox
|
||||
|
||||
|
||||
! call test_random(20)
|
||||
|
||||
call test_random(10)
|
||||
|
||||
STOP ': BECAUSE JOB IS DONE'
|
||||
|
||||
@@ -20,18 +12,19 @@ program essai
|
||||
contains
|
||||
|
||||
subroutine test_random(nbre)
|
||||
implicit none
|
||||
integer, intent(in) :: nbre
|
||||
integer :: foo, bar
|
||||
real :: quux
|
||||
integer :: foo
|
||||
real :: quux, bar
|
||||
double precision :: somme
|
||||
|
||||
call init_random_seed() ! in module 'mathstuff'
|
||||
somme = 0.0
|
||||
do foo=1, nbre
|
||||
quux = rand()
|
||||
quux = 10.0 * rand()
|
||||
somme = somme + quux
|
||||
bar = mod(irand(), 7)
|
||||
print *, foo, quux, somme/foo, bar
|
||||
bar = quux ** (.1/.3)
|
||||
print *, quux, bar, somme/foo
|
||||
enddo
|
||||
end subroutine test_random
|
||||
! --------------------------------------------------------------
|
||||
|
||||
@@ -34,7 +34,8 @@ program exportbloubs
|
||||
endif
|
||||
if (bloub%alive) then
|
||||
print *, bloub%px, bloub%py, bloub%pz, bloub%radius, &
|
||||
bloub%age, bloub%state
|
||||
bloub%age, bloub%state, " ", &
|
||||
bloub%red, bloub%green, bloub%blue
|
||||
compte = compte + 1
|
||||
endif
|
||||
enddo
|
||||
|
||||
@@ -33,8 +33,8 @@ program genbloubs
|
||||
|
||||
bloub%nick = 'noname '
|
||||
bloub%num = i + 41
|
||||
call make_a_random_bloub(bloub)
|
||||
bloub%radius = 0.035 + (0.03*rand())
|
||||
call make_a_random_bloub(bloub, 11.80)
|
||||
bloub%radius = 0.010 + (0.12*rand())
|
||||
|
||||
write(idu) bloub ! no error control ?
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
program movebloubs
|
||||
program listbloubs
|
||||
|
||||
use bloubspace
|
||||
implicit none
|
||||
@@ -33,13 +33,13 @@ program movebloubs
|
||||
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, 1X, I4)') &
|
||||
write(6, '(A8, 1X, 1L, 1X, I2, 1X, F8.3, 1X, 3F8.3, 1X, 3F8.3, 1X, 2I4)') &
|
||||
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, &
|
||||
bloubs(i)%age
|
||||
bloubs(i)%age, bloubs(i)%agemax
|
||||
enddo
|
||||
|
||||
end program
|
||||
|
||||
@@ -8,18 +8,20 @@ module mathstuff
|
||||
! not really tested yet...
|
||||
|
||||
subroutine init_random_seed()
|
||||
implicit none
|
||||
|
||||
integer, dimension(3) :: tarray
|
||||
integer :: t3, foo
|
||||
real :: dummy
|
||||
|
||||
call itime(tarray)
|
||||
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)
|
||||
|
||||
! after initializing the random generator engine,
|
||||
! you MUST use it for initializing the initializer
|
||||
do foo=1, tarray(1)+5
|
||||
do foo=1, tarray(1)+15
|
||||
dummy = rand()
|
||||
enddo
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ program mergebloubs
|
||||
!-------------------------------------------!
|
||||
|
||||
use bloubspace
|
||||
use mathstuff2
|
||||
implicit none
|
||||
|
||||
integer, parameter :: NB_MAX_BLOUBS = 250000
|
||||
@@ -24,16 +25,18 @@ program mergebloubs
|
||||
call getarg(1, infile)
|
||||
call getarg(2, outfile)
|
||||
|
||||
write(0, '(A, 2A15, I8)') "### mergebloubs ", &
|
||||
write(0, '(A, A, 1X, A, 1X, I6)') "### mergebloubs ", &
|
||||
trim(infile), trim(outfile), NB_MAX_BLOUBS
|
||||
|
||||
call init_random_seed()
|
||||
|
||||
allocate (bloubs(NB_MAX_BLOUBS), stat=errcode)
|
||||
if (0 .NE. errcode) then
|
||||
STOP " : NO ENOUGH MEMORY"
|
||||
endif
|
||||
|
||||
call slurp_bloubs_file_in_array(trim(infile), bloubs, nbgot)
|
||||
write(0, '(A,I6,1X,A)') " slurped ", nbgot, "bloubs"
|
||||
write(0, '(A,I0,1X,A)') " slurped ", nbgot, "bloubs"
|
||||
|
||||
contacts = 0
|
||||
do ia = 1, nbgot
|
||||
@@ -42,19 +45,28 @@ program mergebloubs
|
||||
dist = distance_of_bloubs(bloubs(ia), bloubs(ib))
|
||||
radd = bloubs(ia)%radius + bloubs(ib)%radius
|
||||
if (dist .LT. radd) then
|
||||
|
||||
contacts = contacts + 1
|
||||
call merge_two_bloubs(bloubs(ia), bloubs(ib), merged)
|
||||
bloubs(ia) = merged
|
||||
bloubs(ia)%nick = "marged"
|
||||
bloubs(ia)%state = 1;
|
||||
bloubs(ib)%alive = .FALSE.
|
||||
write(0, *) " *** merged ", ia, " and ", ib, &
|
||||
" new r = ", merged%radius
|
||||
|
||||
! call display_bloub (bloubs(ia), "juste merged")
|
||||
|
||||
endif
|
||||
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call spit_bloubs_to_file (outfile, bloubs, nbgot)
|
||||
! print *, contacts, "contacts pour ", nbgot, "bloubs"
|
||||
if (contacts .GT. 0) then
|
||||
write(0, '(A,I0,A,I0,A)') &
|
||||
" merge: ", contacts, " contacts pour ", nbgot, " bloubs"
|
||||
endif
|
||||
|
||||
! STOP 'mergebloubs [done]'
|
||||
|
||||
@@ -63,12 +75,21 @@ program mergebloubs
|
||||
contains
|
||||
|
||||
subroutine merge_two_bloubs(bla, blb, blr)
|
||||
implicit none
|
||||
type(t_bloubs), intent(in) :: bla, blb
|
||||
type(t_bloubs), intent(out) :: blr
|
||||
|
||||
real :: va, vb
|
||||
!-
|
||||
! XXX please insert here a static counter for the 'num' id
|
||||
!-
|
||||
|
||||
blr%nick = "merged "
|
||||
blr%num = 0 ! ???
|
||||
|
||||
va = bla%radius * bla%radius * bla%radius
|
||||
vb = blb%radius * blb%radius * blb%radius
|
||||
|
||||
blr%px = (bla%px + blb%px) / 2.0
|
||||
blr%py = (bla%py + blb%py) / 2.0
|
||||
blr%pz = (bla%pz + blb%pz) / 2.0
|
||||
@@ -76,8 +97,13 @@ contains
|
||||
blr%vx = (bla%vx + blb%vx) / 2.0
|
||||
blr%vy = (bla%vy + blb%vy) / 2.0
|
||||
blr%vz = (bla%vz + blb%vz) / 2.0
|
||||
if (0.001 .GT. rand()) then
|
||||
blr%vx = blr%vx * 1.04
|
||||
blr%vy = blr%vy * 1.04
|
||||
blr%vz = blr%vz * 1.04
|
||||
endif
|
||||
|
||||
blr%radius = (bla%radius + blb%radius) / 2.222
|
||||
blr%radius = (va + vb) ** 0.33335
|
||||
blr%age = min(bla%age, blb%age)
|
||||
|
||||
! bring it to life !
|
||||
|
||||
@@ -2,7 +2,7 @@ program movebloubs
|
||||
|
||||
use bloubspace
|
||||
use povstuff
|
||||
use mathstuff
|
||||
use mathstuff2
|
||||
|
||||
implicit none
|
||||
|
||||
@@ -14,8 +14,6 @@ program movebloubs
|
||||
! logical :: add_new_bloub = .TRUE.
|
||||
real :: rnd
|
||||
|
||||
call init_random_seed()
|
||||
|
||||
i = IARGC()
|
||||
if (i .ne. 2) then
|
||||
STOP ": BAD ARGS ON COMMAND LINE"
|
||||
@@ -26,6 +24,8 @@ program movebloubs
|
||||
write (0, '(A)') &
|
||||
"### moving bloubs from "//trim(infile)//" to "//trim(outfile)
|
||||
|
||||
call init_random_seed()
|
||||
|
||||
open(newunit=inu, &
|
||||
file=trim(infile), form='unformatted', &
|
||||
iostat=errcode, &
|
||||
@@ -48,6 +48,9 @@ program movebloubs
|
||||
compteur = 0
|
||||
killed = 0
|
||||
|
||||
!-
|
||||
! begin of bigloop
|
||||
!-
|
||||
do
|
||||
read (unit=inu, iostat=errcode) bloub
|
||||
if (0 .ne. errcode) then
|
||||
@@ -58,15 +61,19 @@ program movebloubs
|
||||
! moving, morphing and boundingboxing
|
||||
call move_bloub (bloub, 0.185)
|
||||
call bound_a_bloub (bloub)
|
||||
if (bloub%radius .GT. 0.0238) then
|
||||
bloub%radius = bloub%radius * 0.996
|
||||
if (bloub%radius .GT. 3.50) then
|
||||
bloub%radius = bloub%radius * 0.999
|
||||
endif
|
||||
|
||||
call green_soylent (bloub)
|
||||
if (.NOT. bloub%alive) then
|
||||
! write(0, '(A)') " KILL!"
|
||||
killed = killed + 1
|
||||
endif
|
||||
! if (bloub%radius .LT. 0.00015) then
|
||||
! bloub%alive = .FALSE.
|
||||
! endif
|
||||
|
||||
! XXX call green_soylent (bloub)
|
||||
! XXX if (.NOT. bloub%alive) then
|
||||
! XXX ! write(0, '(A)') " KILL!"
|
||||
! XXX killed = killed + 1
|
||||
! XXX endif
|
||||
|
||||
! calcul du barycentre
|
||||
bx = bx + dble(bloub%px)
|
||||
@@ -84,52 +91,46 @@ program movebloubs
|
||||
enddo ! end of main loop
|
||||
|
||||
write(0, '(1X,I0,1X,A)') compteur, "bloubs processed"
|
||||
|
||||
! ok, we have read all the bloubs in the input file
|
||||
|
||||
! insert some fancy conditional here
|
||||
if (compteur .LT. 200) then
|
||||
call add_more_bloubs(outu, 4, 0.026)
|
||||
endif
|
||||
|
||||
! insert some very fancy conditional here
|
||||
if (compteur .LT. 800) then
|
||||
rnd = rand()
|
||||
! write (0, '(A,1X,F9.6)') "try to add bloubs, rnd is", rnd
|
||||
if (rnd .LT. 0.0604) then
|
||||
call add_more_bloubs(outu, 11, 0.019)
|
||||
endif
|
||||
endif
|
||||
|
||||
close(inu) ; close(outu)
|
||||
|
||||
if (killed .GT. 0) then
|
||||
write (0, '(1X,I0,A)') killed, " bloubs killed"
|
||||
endif
|
||||
|
||||
bx = bx / dble(compteur)
|
||||
by = by / dble(compteur)
|
||||
bz = bz / dble(compteur)
|
||||
write (0, '(A,3(F12.6,3X))') "barycentre : ", bx, by, bz
|
||||
! ok, we have read all the bloubs from the input file
|
||||
|
||||
! insert some fancy conditional here
|
||||
if (compteur .LT. 50) then
|
||||
call add_more_bloubs(outu, 5, 0.046)
|
||||
endif
|
||||
|
||||
rnd = rand()
|
||||
! write(0, *) 'rnd= ', rnd
|
||||
if (rnd .LT. 0.18) then
|
||||
write (0, *) '... random of life ...'
|
||||
call add_more_bloubs(outu, 5, 0.056)
|
||||
endif
|
||||
|
||||
close(inu) ; close(outu)
|
||||
|
||||
! --------------------------------------------------------------
|
||||
contains
|
||||
|
||||
subroutine add_more_bloubs(un, nbre, rayon)
|
||||
implicit none
|
||||
integer, intent(in) :: un, nbre
|
||||
real, intent(in) :: rayon
|
||||
type(t_bloubs) :: bloub
|
||||
integer :: foo, count
|
||||
|
||||
count = nbre+mod(irand(), 6)
|
||||
write(0, '(A,I4,1X,A)') "adding", count, "bloubs"
|
||||
count = nbre+mod(irand(), 2)
|
||||
write(0, '(1X,A,I0,1X,A)') "movebloubs: adding ", count, " bloubs"
|
||||
|
||||
do foo=1, count
|
||||
|
||||
bloub%nick = 'newbie '
|
||||
call make_a_random_bloub(bloub)
|
||||
bloub%radius = rayon + (0.05*rand())
|
||||
call make_a_random_bloub(bloub, 10.00)
|
||||
bloub%radius = rayon + (0.11*rand())
|
||||
bloub%age = 1
|
||||
bloub%agemax = 160 + (count * 4)
|
||||
bloub%alive = .TRUE.
|
||||
bloub%num = mod(irand(), 42)
|
||||
write(un) bloub ! no error control ?
|
||||
|
||||
5
BloubWorld/plotbary.sh
Executable file
5
BloubWorld/plotbary.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
BARYDATAS="WS/log.barycentres"
|
||||
|
||||
wc -l $BARYDATAS
|
||||
24
BloubWorld/plotworld.sh
Executable file
24
BloubWorld/plotworld.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
INFILE="out.blbs"
|
||||
SSV="WS/out.ssv"
|
||||
IMAGE="dessin.png"
|
||||
|
||||
./listbloubs $INFILE > $SSV
|
||||
|
||||
|
||||
timestamp=$(date --utc)
|
||||
|
||||
gnuplot << __EOC__
|
||||
set term png size 720,720
|
||||
set output "${IMAGE}"
|
||||
set grid front
|
||||
set tics 1
|
||||
|
||||
set title "High density bloub world - ${timestamp}"
|
||||
|
||||
plot \
|
||||
"${SSV}" using 5:6 lt rgb "#002090"
|
||||
__EOC__
|
||||
|
||||
echo 'done'
|
||||
@@ -13,6 +13,7 @@ module povstuff
|
||||
contains ! -----------------------------------------
|
||||
|
||||
subroutine show_bbox( bbox )
|
||||
implicit none
|
||||
type (t_boundb), intent(in) :: bbox
|
||||
|
||||
print *, bbox%bbminx, bbox%bbminy, bbox%bbminz
|
||||
@@ -23,6 +24,7 @@ module povstuff
|
||||
! ----------------------------------------------------------------
|
||||
|
||||
subroutine start_of_inc_file (fd)
|
||||
implicit none
|
||||
integer, intent (in) :: fd
|
||||
|
||||
write(fd, '(A)') "// DON'T EDIT THIS FILE !"
|
||||
|
||||
@@ -7,16 +7,19 @@
|
||||
|
||||
INCFILE="WS/bloubs.inc"
|
||||
TMPPNG="/dev/shm/bloubs7.png"
|
||||
POVOPT="+Q9 -a -v -d -W1600 -H1200 -WT2"
|
||||
POVOPT="+Q9 +a -v -d -W1024 -H768 -WT2"
|
||||
DDIR="frames/a"
|
||||
LOGERR="log.error"
|
||||
TXTCOLOR="#db7000"
|
||||
TXTCOLOR="#db4090"
|
||||
|
||||
BLOUBDATAS="WS/bloubs.data"
|
||||
BARYDATAS="WS/log.barycentres"
|
||||
|
||||
# --- put the work file in ramdisk
|
||||
BLBS_IN="/dev/shm/in.blbs"
|
||||
BLBS_OUT="/dev/shm/out.blbs"
|
||||
|
||||
NBIMG=120
|
||||
NBIMG=2000
|
||||
|
||||
make all
|
||||
err=$?
|
||||
@@ -31,14 +34,20 @@ 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} 50
|
||||
./genbloubs ${BLBS_IN} 2
|
||||
|
||||
for idx in $(seq 0 $((NBIMG-1)) )
|
||||
do
|
||||
|
||||
echo "======== run passe $idx ========="
|
||||
echo "================= run passe $idx ===================="
|
||||
|
||||
./exportbloubs ${BLBS_IN} | awk -f toinc.awk > $INCFILE
|
||||
# make the bloubs's data readable by POVray
|
||||
#
|
||||
./exportbloubs ${BLBS_IN} > $BLOUBDATAS
|
||||
awk -f toinc.awk < $BLOUBDATAS > $INCFILE
|
||||
awk '{ print $1, $2, $3 }' < $BLOUBDATAS > $BARYDATAS
|
||||
|
||||
echo "### raytracing pass $idx"
|
||||
|
||||
povray -Iscene.pov -K${idx} -O${TMPPNG} ${POVOPT} 2> $LOGERR
|
||||
if [ 0 -ne $? ] ; then
|
||||
@@ -46,35 +55,34 @@ do
|
||||
sleep 90
|
||||
fi
|
||||
|
||||
td=$(date -u +'%F %R:%S' | tr '01' 'ol')
|
||||
hi=$(printf "#%05d" $idx | tr '01' 'ol')
|
||||
count=$(tail -1 "WS/log.nb_bloubs")
|
||||
td=$(date -u +'%F %R' | tr '01' 'ol')
|
||||
hi=$(printf "#%04d" $idx | tr '01' 'ol')
|
||||
count=$(tail -1 "WS/log.nb_bloubs" | tr '01' 'ol')
|
||||
|
||||
PNG=$(printf "%s/%05d.png" ${DDIR} $idx)
|
||||
|
||||
convert ${TMPPNG} \
|
||||
-font Courier-Bold \
|
||||
-pointsize 28 \
|
||||
-pointsize 32 \
|
||||
-fill "$TXTCOLOR" \
|
||||
-gravity south-east \
|
||||
-annotate +25+5 "$td" \
|
||||
-gravity south-west \
|
||||
-annotate +25+5 "$hi" \
|
||||
-pointsize 48 \
|
||||
-gravity north-east \
|
||||
-annotate +45+5 "$count" \
|
||||
-gravity north-west \
|
||||
-annotate +45+5 "BloubWorld" \
|
||||
$PNG
|
||||
|
||||
echo $PNG '[done]'
|
||||
echo ' ' $PNG '[done]'
|
||||
|
||||
./movebloubs ${BLBS_IN} ${BLBS_OUT}
|
||||
./mergebloubs ${BLBS_OUT} ${BLBS_IN}
|
||||
# mv ${BLBS_OUT} ${BLBS_IN}
|
||||
|
||||
echo
|
||||
sleep 90
|
||||
echo "### run done"
|
||||
sleep 35
|
||||
|
||||
done
|
||||
|
||||
|
||||
@@ -44,48 +44,97 @@ union {
|
||||
}
|
||||
}
|
||||
|
||||
plane { y, 0 pigment { color White } translate -4.20*y}
|
||||
cylinder { 0, -y, 30
|
||||
texture {
|
||||
pigment { color srgb <0.225, 0.244, 0.211> }
|
||||
finish { phong 0.18 metallic 0.25 reflection 0.10 }
|
||||
}
|
||||
translate -6.20*y
|
||||
}
|
||||
|
||||
sky_sphere {
|
||||
pigment { color Gray20 }
|
||||
emission rgb <0.01, 0.01, 0.01>
|
||||
}
|
||||
|
||||
// object { cylinder { <0, 0, 0>, <10, 0, 0>, 0.05 pigment { color Cyan } } }
|
||||
// ----------------------------------------------------------
|
||||
|
||||
#declare Croisillon = object
|
||||
{
|
||||
#local SC = 0.75;
|
||||
union {
|
||||
cylinder { -SC*x, SC*x, 0.04 }
|
||||
cylinder { -SC*y, SC*y, 0.04 }
|
||||
cylinder { -SC*z, SC*z, 0.04 }
|
||||
}
|
||||
texture {
|
||||
pigment { color Gray50 }
|
||||
}
|
||||
}
|
||||
|
||||
object { Croisillon scale 0.90 translate <Bary_X, Bary_Y, Bary_Z> }
|
||||
|
||||
// ----------------------------------------------------------
|
||||
|
||||
#declare BH = 6; // H = taille en horizontal
|
||||
#declare BV = 4; // V = taille en vertical
|
||||
#declare BR = 0.034;
|
||||
#declare BV = 6; // V = taille en vertical
|
||||
#declare BR = 0.056;
|
||||
|
||||
#declare Une_Borne = object
|
||||
{
|
||||
merge {
|
||||
cylinder { <0, BV, 0>, <0, -BV, 0>, BR }
|
||||
cylinder { <0, 0.018, 0>, <0, -0.018, 0>, BR*3 }
|
||||
cylinder { <0, 0.042, 0>, <0, -0.042, 0>, BR*1.90 }
|
||||
}
|
||||
}
|
||||
|
||||
#local Ruc = BR * 0.90;
|
||||
#local Rud = BR * 0.30;
|
||||
|
||||
#declare Un_Cadre = object
|
||||
{
|
||||
merge {
|
||||
#local Ruc = BR * 0.90;
|
||||
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>, Ruc }
|
||||
cylinder { < BH, 0, 0>, <-BH, 0, 0>, Rud }
|
||||
cylinder { < 0, 0, -BH>, < 0, 0, BH>, Rud }
|
||||
}
|
||||
texture {
|
||||
pigment { color Gray50 }
|
||||
finish { phong 0.87 specular 0.57 }
|
||||
}
|
||||
}
|
||||
|
||||
#declare Montants = object
|
||||
{
|
||||
union {
|
||||
cylinder { <-BH, -BH, 0>, <-BH, BH, 0>, Rud }
|
||||
cylinder { < BH, -BH, 0>, < BH, BH, 0>, Rud }
|
||||
cylinder { < 0, -BH, -BH>, < 0, BH, -BH>, Rud }
|
||||
cylinder { < 0, -BH, BH>, < 0, BH, BH>, Rud }
|
||||
}
|
||||
texture {
|
||||
pigment { color Gray50 }
|
||||
finish { phong 0.57 specular 0.87 }
|
||||
}
|
||||
pigment { color Gray40 }
|
||||
}
|
||||
|
||||
#declare Les_Bornes = object
|
||||
{
|
||||
union {
|
||||
#local E = 0.0015;
|
||||
#local E = 0.0005;
|
||||
object { Un_Cadre translate y*(BV-E) }
|
||||
object { Un_Cadre translate -y*(BV-E) }
|
||||
|
||||
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 } }
|
||||
object { Une_Borne translate < BH, 0, BH> pigment { color Red } }
|
||||
object { Montants }
|
||||
|
||||
#local G = Green * 0.80;
|
||||
object { Une_Borne translate <-BH, 0, -BH> pigment { color Blue*0.9 } }
|
||||
object { Une_Borne translate < BH, 0, -BH> pigment { color G } }
|
||||
object { Une_Borne translate <-BH, 0, BH> pigment { color G } }
|
||||
object { Une_Borne translate < BH, 0, BH> pigment { color Red*0.9 } }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,22 +161,20 @@ union {
|
||||
}
|
||||
// ----------------------------------------------------------
|
||||
|
||||
light_source { <19, 12+NormClock, -17> color Gray80 }
|
||||
light_source { <11, 10-NormClock, -29> color Gray60 }
|
||||
light_source { < 19, 12+NormClock, -17> color Gray80 }
|
||||
light_source { <-14, 10-NormClock, -29> color Gray70 }
|
||||
|
||||
#declare XCAM = 8 - ( 15 * NormClock);
|
||||
#declare YCAM = -1.1 + (0.95 * NormClock);
|
||||
#declare ZCAM = -13.10;
|
||||
#declare XCAM = 5 - ( 10 * NormClock);
|
||||
#declare YCAM = -1.1 + (1.25 * NormClock);
|
||||
#declare ZCAM = -19.20;
|
||||
|
||||
#declare XLAT = Bary_X;
|
||||
#declare YLAT = Bary_Y;
|
||||
#declare ZLAT = Bary_Z;
|
||||
|
||||
// object { Repere scale 2.5 translate <XLAT, YLAT, ZLAT> }
|
||||
#declare XLAT = 0;
|
||||
#declare YLAT = 0;
|
||||
#declare ZLAT = 0;
|
||||
|
||||
camera {
|
||||
location <XCAM, YCAM, ZCAM>
|
||||
look_at <XLAT, YLAT, ZLAT>
|
||||
right x*image_width/image_height
|
||||
angle 86
|
||||
angle 64
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ BEGIN {
|
||||
count = 0
|
||||
bx = by = bz = 0.0
|
||||
print "// GENERATED FILE, DON'T TOUCH IT !"
|
||||
print "// --------------------------------"
|
||||
print
|
||||
print "#declare Bloubs = object\n{"
|
||||
print "union\t{"
|
||||
}
|
||||
@@ -18,27 +20,31 @@ BEGIN {
|
||||
merged = $6
|
||||
|
||||
color = "Cyan"
|
||||
if (age < 2) color = "Yellow"
|
||||
if (merged) {
|
||||
if (age > 12) color = "Orange"
|
||||
else color = "Red"
|
||||
if (age > 150) color = "Orange"
|
||||
else color = "Yellow"
|
||||
}
|
||||
else {
|
||||
if (age > 12) color = "CadetBlue"
|
||||
if (age > 150) color = "DarkGreen"
|
||||
else color = "Aquamarine"
|
||||
}
|
||||
if (age < 18) color = "Gray40"
|
||||
if (age < 9) color = "Blue"
|
||||
|
||||
bx += $1
|
||||
by += $2
|
||||
bz += $3
|
||||
pigment = "pigment { color " color " }"
|
||||
printf "\tsphere { <%f, %f, %f>, %f %s }\n", \
|
||||
printf "\tsphere { <%f, %f, %f>, %f \n\t\t%s }\n", \
|
||||
$1, $2, $3, $4, pigment
|
||||
count++
|
||||
}
|
||||
|
||||
END {
|
||||
print "\t} // end of union\n}\n"
|
||||
# print "\t}\n"
|
||||
print "\t} // end of union\n"
|
||||
print "finish { phong 0.57 specular 0.67 }\n"
|
||||
print "}\n"
|
||||
print "#declare Nb_Bloubs = ", count, ";\n"
|
||||
print "#declare Bary_X = ", bx/count, ";";
|
||||
print "#declare Bary_Y = ", by/count, ";";
|
||||
|
||||
2
Fraktalism/.gitignore
vendored
2
Fraktalism/.gitignore
vendored
@@ -6,6 +6,7 @@ mkmandel
|
||||
voxelize
|
||||
evolvopick
|
||||
henon
|
||||
mkhenon
|
||||
essai
|
||||
plotcolmap
|
||||
|
||||
@@ -17,6 +18,7 @@ WS/*.inc
|
||||
toto
|
||||
|
||||
*.pgm
|
||||
*.pnm
|
||||
*.gif
|
||||
*.asc
|
||||
*.png
|
||||
|
||||
@@ -38,12 +38,22 @@ plotcolmap: plotcolmap.f90 Makefile $(OBJDEP)
|
||||
|
||||
# ---------------------------------------------
|
||||
|
||||
mkjulia: mkjulia.f90 Makefile $(OBJDEP)
|
||||
gfortran $(GFOPT) $< $(OBJS) -o $@
|
||||
|
||||
xjulia.pnm: mkjulia Makefile
|
||||
./mkjulia $@ -0.204365 0.321463
|
||||
|
||||
# ---------------------------------------------
|
||||
|
||||
henon: henon.f90 Makefile $(OBJDEP)
|
||||
gfortran $(GFOPT) $< $(OBJS) -o $@
|
||||
|
||||
mkjulia: mkjulia.f90 Makefile $(OBJDEP)
|
||||
mkhenon: mkhenon.f90 Makefile $(OBJDEP)
|
||||
gfortran $(GFOPT) $< $(OBJS) -o $@
|
||||
|
||||
# ---------------------------------------------
|
||||
|
||||
pickover: pickover.f90 Makefile $(OBJDEP)
|
||||
gfortran $(GFOPT) $< $(OBJS) -o $@
|
||||
|
||||
|
||||
@@ -6,6 +6,20 @@ Voyons d'abord
|
||||
[une vidéo](http://la.buvette.org/fractales/f90/video.html)
|
||||
qui montre ma première expérience dans ce domaine.
|
||||
|
||||
## Trucs à voir
|
||||
|
||||
La fractale de Julia se porte plutôt bien, mais les travaux continuent.
|
||||
|
||||
* [mkjuliagif.sh](mkjuliagif.sh) : fabrication de la gif animée
|
||||
* [julias.f90](julias.f90) : fonctions de dessin d'une Julia
|
||||
* [mkjulia.f90](mkjulia.f90) : le programme principal
|
||||
|
||||
**Q:** pourquoi faire la boucle en shell plutôt qu'en Fortran ?
|
||||
|
||||
**A:** Parce que je peux recompiler le binaire `mkjulia` pendant le
|
||||
déroulement de la boucle, une manière comme une autre de faire
|
||||
du *livecoding*.
|
||||
|
||||
## La technique
|
||||
|
||||
Le gros des calculs de fractales est fait dans `mods/fraktals.f90`,
|
||||
@@ -34,10 +48,11 @@ Generally writen as a *sequencial unformated* file.
|
||||
|
||||
## TODO
|
||||
|
||||
- Voir de près le calcul du cadrage
|
||||
- Voir de près le calcul du cadrage : [centermag](../Modules/centermag.f90)
|
||||
- Rajouter des formules
|
||||
- Ne pas procastiner sur le reste
|
||||
|
||||
## See also
|
||||
|
||||
- https://www.maths.town/fractal-articles/mandelbulb/mandelbulb-all-powers/
|
||||
- https://discuss.pixls.us/t/intriguing-shapes-in-buddhabrot-like-fractals/41816
|
||||
|
||||
@@ -36,7 +36,7 @@ TITLE='---{ experimental }---'
|
||||
|
||||
ffmpeg -nostdin \
|
||||
-loglevel warning \
|
||||
-y -r 30 -f image2 -i $SDIR/%05d.pnm \
|
||||
-y -r 30 -f image2 -i $SDIR/%05d.png \
|
||||
-metadata artist='---{ tTh }---' \
|
||||
-metadata title="${TITLE}" \
|
||||
-preset veryslow \
|
||||
|
||||
@@ -137,6 +137,7 @@ subroutine interp4dp (ina, inb, out, dpk)
|
||||
|
||||
end subroutine
|
||||
!-----------------------------------------------------------
|
||||
!-
|
||||
|
||||
function dist0 (x, y)
|
||||
implicit none
|
||||
@@ -146,6 +147,8 @@ function dist0 (x, y)
|
||||
end function
|
||||
|
||||
!-----------------------------------------------------------
|
||||
!-
|
||||
|
||||
function modulus2(pt)
|
||||
implicit none
|
||||
complex, intent(in) :: pt
|
||||
|
||||
@@ -1,31 +1,10 @@
|
||||
program henon
|
||||
module henon
|
||||
|
||||
implicit none
|
||||
|
||||
integer :: passe
|
||||
double precision :: vx, vy
|
||||
|
||||
integer :: w, h
|
||||
integer :: foo, bar
|
||||
double precision :: px, py
|
||||
w = 2000 ; h = 1600
|
||||
|
||||
write(0, *) "###### Mapping of Henon "
|
||||
|
||||
do foo=1, 16
|
||||
px = dble(foo) / 16.0
|
||||
do bar=1,16
|
||||
py = dble(bar) / 16.0
|
||||
call compute_pixel_henon(px, py, 1700, &
|
||||
passe, dble(0.5), vx, vy)
|
||||
write(0, fmt=*) "passe ", passe, vx, vy
|
||||
enddo
|
||||
end do
|
||||
contains
|
||||
|
||||
!-----------------------------------------------------
|
||||
contains
|
||||
!-----------------------------------------------------
|
||||
!-----------------------------------------------------
|
||||
|
||||
subroutine compute_pixel_henon(a, b, maxpasse, passe, limit, rx, ry)
|
||||
implicit none
|
||||
double precision, intent(in) :: a, b, limit
|
||||
@@ -62,5 +41,5 @@ end subroutine
|
||||
|
||||
!-----------------------------------------------------
|
||||
|
||||
end program
|
||||
end module
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
module julias
|
||||
|
||||
use fraktals
|
||||
implicit none
|
||||
contains
|
||||
|
||||
@@ -42,37 +44,47 @@ subroutine simple_julia(pic, cx, cy, maxiter)
|
||||
if (over_iter) then
|
||||
pic(ix, iy) = 0
|
||||
else
|
||||
pic(ix, iy) = iter*12
|
||||
pic(ix, iy) = mod(iter*13, 256)
|
||||
endif
|
||||
enddo ! iy
|
||||
enddo ! ix
|
||||
|
||||
end subroutine simple_julia
|
||||
!===============================================================
|
||||
subroutine julia_colormapped(pic, cx, cy, maxiter)
|
||||
!-
|
||||
! this code is nor really finished
|
||||
!-
|
||||
subroutine julia_colormapped(pic, cx, cy, mag, maxiter)
|
||||
use pixrgb
|
||||
type(t_pixrgb), intent(inout), dimension (:,:) :: pic
|
||||
real, intent(in) :: cx, cy
|
||||
real, intent(in) :: cx, cy, mag
|
||||
integer, intent(in) :: maxiter
|
||||
|
||||
integer :: ix, iy, width, height
|
||||
real :: fx, fy
|
||||
integer :: ix, iy, width, height, iter
|
||||
real :: fx, fy, div, off
|
||||
complex :: Z, C
|
||||
integer :: iter
|
||||
logical :: over_iter
|
||||
integer :: under, over
|
||||
|
||||
pic = t_pixrgb(0, 0, 0)
|
||||
|
||||
width = ubound(pic, 1)
|
||||
height = ubound(pic, 2)
|
||||
C = complex(cx, cy)
|
||||
print *, "Color julia, const = ", C
|
||||
|
||||
div = mag * 10.0 ; off = mag * 2.5
|
||||
under = 0 ; over = 0
|
||||
print *, "mag:", mag, " -> ", div, off
|
||||
|
||||
! print *, "Color julia, const = ", C
|
||||
do ix = 1, width
|
||||
fx = (float(ix) / (float(width*2)/4.0) - 1.0)
|
||||
fx = (float(ix) / (float(width*2)/div) - off)
|
||||
do iy = 1, height
|
||||
fy = (float(iy) / (float(height*2)/4.0) - 1.0)
|
||||
fy = (float(iy) / (float(height*2)/div) - off)
|
||||
! ------ traitement du pixel
|
||||
iter = 0 ; over_iter = .FALSE.
|
||||
Z = complex(fx, fy)
|
||||
do while ((real(Z)*real(Z) + imag(Z)*imag(Z)) .LT. 4.0)
|
||||
do while ((real(Z)*real(Z) + (imag(Z)*imag(Z))) .LT. 4.0)
|
||||
Z = (Z * Z) + C
|
||||
iter = iter + 1
|
||||
if (iter .GE. maxiter) then
|
||||
@@ -81,17 +93,22 @@ subroutine julia_colormapped(pic, cx, cy, maxiter)
|
||||
endif
|
||||
end do
|
||||
if (over_iter) then
|
||||
pic(ix, iy)%r = 0
|
||||
pic(ix, iy)%g = mod(abs(int(real(Z) *140)), 255)
|
||||
pic(ix, iy)%b = mod(abs(int(aimag(Z)*140)), 255)
|
||||
pic(ix, iy)%r = mod(int(modulus2(Z)*2000.0), 255)
|
||||
pic(ix, iy)%g = mod(abs(int(real(Z) *11.0)), 255)
|
||||
pic(ix, iy)%b = mod(abs(int(aimag(Z)*11.0)), 255)
|
||||
print *, ix, iy, Z, modulus2(Z)
|
||||
over = over + 1
|
||||
else
|
||||
pic(ix, iy)%r = mod(iter*33, 255)
|
||||
pic(ix, iy)%g = mod(iter*59, 255)
|
||||
pic(ix, iy)%b = mod(iter*41, 255)
|
||||
pic(ix, iy)%r = mod(iter*11, 255)
|
||||
pic(ix, iy)%g = mod(iter*14, 255)
|
||||
pic(ix, iy)%b = mod(iter*17, 255)
|
||||
under = under + 1
|
||||
endif
|
||||
enddo ! iy
|
||||
enddo ! ix
|
||||
|
||||
print *, "under", under, "over", over
|
||||
|
||||
end subroutine
|
||||
!===============================================================
|
||||
end module
|
||||
|
||||
27
Fraktalism/mkhenon.f90
Normal file
27
Fraktalism/mkhenon.f90
Normal file
@@ -0,0 +1,27 @@
|
||||
program henon
|
||||
|
||||
use PIXRGB
|
||||
|
||||
implicit none
|
||||
|
||||
type(t_pixrgb), allocatable :: picz(:,:)
|
||||
integer :: argc
|
||||
character(200) :: filename, string
|
||||
real :: cx, cy
|
||||
|
||||
argc = IARGC()
|
||||
if (3 .NE. argc) then
|
||||
STOP ": MKHENON PROGGY NEED 3 PARAMETERS !"
|
||||
endif
|
||||
|
||||
call getarg(1, filename)
|
||||
call getarg(2, string) ; read (string, *) cx
|
||||
call getarg(3, string) ; read (string, *) cy
|
||||
|
||||
allocate(picz(1280, 1024))
|
||||
|
||||
call rgbpix_spit_as_pnm_8(picz, trim(filename))
|
||||
|
||||
!-----------------------------------------------------
|
||||
|
||||
end program
|
||||
@@ -26,11 +26,15 @@ program julia
|
||||
call getarg(2, string) ; read (string, *) cx
|
||||
call getarg(3, string) ; read (string, *) cy
|
||||
|
||||
allocate(picz(512, 342))
|
||||
allocate(picz(1280, 1024))
|
||||
|
||||
call julia_colormapped(picz, cx, cy, 500)
|
||||
call julia_colormapped(picz, cx, cy, 0.600, 1000)
|
||||
call rgbpix_spit_as_pnm_8(picz, trim(filename))
|
||||
|
||||
contains
|
||||
|
||||
!-----------------------------------------------------
|
||||
|
||||
end program
|
||||
|
||||
!-----------------------------------------------------
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#
|
||||
# build the prog
|
||||
#
|
||||
|
||||
make mkjulia
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo
|
||||
@@ -11,28 +10,52 @@ if [ $? -ne 0 ] ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cxa=" -1.5432 " ; cya=" -0.8999 "
|
||||
cxb=" 1.0975 " ; cyb=" 1.5091 "
|
||||
nbi=" 2000 "
|
||||
tmpimg="/dev/shm/juliatmp.pnm"
|
||||
|
||||
rm frames/julia/*
|
||||
|
||||
#
|
||||
# run the prog
|
||||
#
|
||||
workdir="frames/julia/"
|
||||
for foo in $(seq 0 179)
|
||||
for foo in $( seq 0 $(( nbi - 1)) )
|
||||
do
|
||||
Ka=$( echo "$foo / $nbi" | bc -l)
|
||||
Kb=$( echo "1.0 - $Ka" | bc -l)
|
||||
# echo $Ka $Kb
|
||||
cx=$(echo "($cxa*$Ka) + ($cxb*$Kb)" | bc -l)
|
||||
cy=$(echo "$cya*$Ka + $cyb*$Kb" | bc -l)
|
||||
|
||||
img=$(printf "%s/%05d.pnm" $workdir $foo)
|
||||
bar=$(echo "$foo / 247.0" | bc -l)
|
||||
cx=$(echo "0.5 * (1.52*c($foo/28.0))" | bc -l)
|
||||
cy=$(echo "0.5 * (1.45*s($foo/17.0))" | bc -l)
|
||||
# make mkjulia
|
||||
|
||||
./mkjulia $img $cx $cy
|
||||
printf "%5d %4.6f %4.6f %4.6f %4.6f\n" \
|
||||
$foo $Ka $Kb $cx $cy
|
||||
./mkjulia $tmpimg $cx $cy
|
||||
echo
|
||||
|
||||
sleep 145
|
||||
img=$(printf "%s/%05d.png" $workdir $foo)
|
||||
tcx=$(printf "%8.6f" $cx)
|
||||
tcy=$(printf "%8.6f" $cy)
|
||||
|
||||
convert $tmpimg \
|
||||
-gravity North-East \
|
||||
-font Courier-Bold \
|
||||
-pointsize 20 \
|
||||
-fill Yellow \
|
||||
-annotate +15+34 $tcx \
|
||||
-annotate +15+58 $tcy \
|
||||
-gravity South-East \
|
||||
-font Courier \
|
||||
-pointsize 14 \
|
||||
-fill Yellow \
|
||||
-annotate +10+6 "Konrad+tTh 2024" \
|
||||
$img
|
||||
|
||||
done
|
||||
|
||||
./tagpicz.sh $workdir
|
||||
|
||||
echo ; echo "Encoding, please wait..."
|
||||
|
||||
convert -delay 10 $workdir/*.pnm color-julia.gif
|
||||
# animate foo.gif &
|
||||
|
||||
./encode.sh frames/julia/ foo.mp4
|
||||
|
||||
@@ -17,10 +17,10 @@ do
|
||||
|
||||
mogrify \
|
||||
-gravity South-East \
|
||||
-font Courier \
|
||||
-font Courier-Bold \
|
||||
-pointsize 12 \
|
||||
-fill firebrick \
|
||||
-annotate +10+10 "Konrad+tTh 2023" \
|
||||
-fill Black \
|
||||
-annotate +10+4 "Konrad+tTh 2024" \
|
||||
$img
|
||||
echo "tagging " $img
|
||||
|
||||
|
||||
2
GrafAnim/.gitignore
vendored
2
GrafAnim/.gitignore
vendored
@@ -6,6 +6,7 @@ trigofest
|
||||
noisepic
|
||||
geowaves
|
||||
soundscope
|
||||
readpicz
|
||||
|
||||
*.scratch
|
||||
*.genplot
|
||||
@@ -16,4 +17,5 @@ F/*.tga
|
||||
*.pgm
|
||||
*.data
|
||||
*.png
|
||||
log.txt
|
||||
|
||||
|
||||
@@ -24,10 +24,7 @@ trigofest: trigofest.f90 Makefile vue3axes.o utils_ga.o
|
||||
gfortran $(GFOPT) $< $(MYLIB) utils_ga.o -o $@
|
||||
|
||||
noisepic: noisepic.f90 Makefile
|
||||
gfortran $(GFOPT) $< $(MYLIB) \
|
||||
-o $@
|
||||
|
||||
# ---- bienvenue dans le monde applicatif
|
||||
gfortran $(GFOPT) $< $(MYLIB) -o $@
|
||||
|
||||
wavmetrics.o: wavmetrics.f90 Makefile
|
||||
gfortran $(GFOPT) -c $<
|
||||
@@ -35,6 +32,9 @@ wavmetrics.o: wavmetrics.f90 Makefile
|
||||
soundscope: soundscope.f90 Makefile utils_ga.o
|
||||
gfortran $(GFOPT) $< $(MYLIB) utils_ga.o -o $@
|
||||
|
||||
readpicz: readpicz.f90 Makefile utils_ga.o
|
||||
gfortran $(GFOPT) $< $(MYLIB) utils_ga.o -o $@
|
||||
|
||||
# ---- modules locaux ----
|
||||
|
||||
usegenplot.o: usegenplot.f90 Makefile
|
||||
|
||||
@@ -3,12 +3,16 @@
|
||||
Quelques essais approximatifs pour faire des graphiques inutiles,
|
||||
dans une démarche mettant en avant la
|
||||
[techno-futilité](https://wiki.interhacker.space/index.php?title=Techno-futilit%C3%A9),
|
||||
une notion bien définie par le collectif Interhack.
|
||||
une notion bien définie par le collectif **Interhack**.
|
||||
|
||||
Actuellement, certains des logiciels que vous voyez ici utilisent un backend
|
||||
graphique brassé à la maison et nommé `genplot2`. Hélas, celui-ci est
|
||||
Actuellement, certains des logiciels que vous voyez ici utilisent un backend graphique brassé
|
||||
[à la maison](https://git.tetalab.org/tTh/libtthimage)
|
||||
et nommé `genplot2`. Hélas, celui-ci est
|
||||
un peu foireux sur les tracés de ligne...
|
||||
|
||||
## geowaves
|
||||
|
||||
Une idée en l'air, probablement...
|
||||
|
||||
## trigofest
|
||||
|
||||
@@ -20,15 +24,11 @@ que c'est d'la balle !
|
||||
|
||||
Ou comment dessiner des gaussiennes en jetant des dés.
|
||||
|
||||
## vue3axes
|
||||
|
||||
Un module assez spécialisé.
|
||||
|
||||
## soundscope
|
||||
|
||||
Retranscription en image de type oscilloscope d'un fichier son.
|
||||
Le code source ([soundscope.f90](soundscope.f90)) est encore
|
||||
bien gore.
|
||||
Une tentative de retranscription en image de type oscilloscope/vumètre d'un fichier son.
|
||||
Les codes source du proggy ([soundscope.f90](soundscope.f90)) et du
|
||||
[module](utils_ga.f90) associé sont encore bien *gore*.
|
||||
|
||||
Pour convertir le son en données exploitables, il faut utiliser ce [bout de code](../SoundBrotching/c-tools/text2wav.c). Certaines fonctions utilisée par ce logiciel sont dans [utils_ga.f90](utils_ga.f90)
|
||||
pour la partie dessin.
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
program essai
|
||||
|
||||
! *******************************************
|
||||
! CE TRUC NE MARCHE PAS /O\
|
||||
! *******************************************
|
||||
|
||||
use pixrgb
|
||||
implicit none
|
||||
|
||||
@@ -60,6 +64,7 @@ subroutine setpixel(pic, x, y)
|
||||
.and. &
|
||||
(iy .gt. lbound(pic, 2)) .and. (iy .lt. ubound(pic, 2)) ) &
|
||||
then
|
||||
pix(ix, iy)%r = 0
|
||||
pic(ix, iy)%g = 65000
|
||||
pic(ix, iy)%b = 20000
|
||||
else
|
||||
|
||||
35
GrafAnim/geowaves.f90
Normal file
35
GrafAnim/geowaves.f90
Normal file
@@ -0,0 +1,35 @@
|
||||
! *******************************************
|
||||
!
|
||||
! *******************************************
|
||||
|
||||
program geowaves
|
||||
|
||||
use pixrgb
|
||||
implicit none
|
||||
|
||||
integer :: width = 640
|
||||
integer :: height = 480
|
||||
integer :: marge = 10
|
||||
type(t_pixrgb), allocatable :: pix(:,:)
|
||||
integer :: x, y, h
|
||||
real :: dist
|
||||
|
||||
allocate(pix(width, height))
|
||||
|
||||
do x=marge, width-marge
|
||||
|
||||
! write (0, *) " Y =", y
|
||||
|
||||
do y=marge, height-marge, 5
|
||||
|
||||
print *, x, y
|
||||
pix(x, y)%g = 30000
|
||||
|
||||
enddo
|
||||
|
||||
enddo
|
||||
|
||||
call rgbpix_spit_as_pnm_16(pix, "foo.pnm")
|
||||
|
||||
end program geowaves
|
||||
|
||||
59
GrafAnim/readpicz.f90
Normal file
59
GrafAnim/readpicz.f90
Normal file
@@ -0,0 +1,59 @@
|
||||
program readpicz
|
||||
|
||||
use pixrgb
|
||||
implicit none
|
||||
|
||||
integer :: nbarg
|
||||
integer :: param0 = 10
|
||||
character(len=256) :: arg
|
||||
|
||||
! integer :: foo, bar
|
||||
|
||||
integer :: width = 640
|
||||
integer :: height = 480
|
||||
integer :: x, y, r, g, b
|
||||
integer :: errcode
|
||||
character (len=280) :: filename
|
||||
type(t_pixrgb), allocatable :: pix(:,:)
|
||||
|
||||
filename = "out.pnm"
|
||||
|
||||
nbarg = IARGC()
|
||||
if (nbarg .GT. 0) then
|
||||
call GETARG(1, arg)
|
||||
! write (0, '(A40, A5)') "argument = ", arg
|
||||
read (arg, *) param0
|
||||
endif
|
||||
|
||||
allocate(pix(width, height))
|
||||
|
||||
do
|
||||
!----- get a pixel
|
||||
read(5, *, iostat=errcode) x, y, r, g, b
|
||||
! print *, x, y
|
||||
if (0 .NE. errcode) then
|
||||
write(0, *) "iostat", errcode
|
||||
exit
|
||||
endif
|
||||
if (mod(y, 2) .EQ. 1) then
|
||||
pix(x+1, y+1)%r = g * 200
|
||||
pix(x+1, y+1)%g = b * 200
|
||||
pix(x+1, y+1)%b = r * 200
|
||||
else
|
||||
pix(x+1, y+1)%r = g * 200
|
||||
pix(x+1, y+1)%g = r * 200
|
||||
pix(x+1, y+1)%b = b * 200
|
||||
endif
|
||||
|
||||
enddo
|
||||
|
||||
call rgbpix_spit_as_pnm_16(pix, trim(filename))
|
||||
|
||||
contains
|
||||
! ----------------------------------------------------------
|
||||
|
||||
|
||||
! ----------------------------------------------------------
|
||||
|
||||
end program
|
||||
|
||||
@@ -9,11 +9,13 @@ program soundscope
|
||||
|
||||
implicit none
|
||||
|
||||
integer :: width = 720
|
||||
integer :: height = 576
|
||||
integer :: marge = 32
|
||||
integer :: samplerate = 44100
|
||||
integer :: framerate = 30
|
||||
integer :: width = 800
|
||||
integer :: height = 600
|
||||
integer :: marge = 32
|
||||
integer :: samplerate = 44100
|
||||
integer :: framerate = 30
|
||||
|
||||
integer, parameter :: overtrig = 25200
|
||||
|
||||
type(t_pixrgb), allocatable :: pix(:,:)
|
||||
character (len=280) :: filename
|
||||
@@ -21,11 +23,14 @@ program soundscope
|
||||
integer :: smppf
|
||||
logical :: flagdone
|
||||
|
||||
|
||||
smppf = samplerate / framerate
|
||||
write(0, *) "sample rate = ", samplerate
|
||||
write(0, *) "frames per second = ", framerate
|
||||
write(0, *) "samples per frame = ", smppf
|
||||
|
||||
|
||||
allocate(pix(width, height))
|
||||
call fill_random_gauss(pix, 65000, marge)
|
||||
! call fill_random_gauss(pix, 65000, marge)
|
||||
|
||||
iter = 0
|
||||
do
|
||||
@@ -46,13 +51,19 @@ program soundscope
|
||||
enddo
|
||||
|
||||
call dim_pix_rgb_mul(pix, 0.86)
|
||||
if (mod(iter, 180) .LT. 90) then
|
||||
call make_a_frame_dplot(pix, smppf, flagdone)
|
||||
else
|
||||
call make_a_frame_xy(pix, smppf, flagdone)
|
||||
endif
|
||||
|
||||
call dessine_cadre(pix, 65000, 65000, 65000, marge)
|
||||
foo = mod(iter/36, 3)
|
||||
! print *, iter, " --> ", foo
|
||||
select case(foo)
|
||||
case(0)
|
||||
call make_a_frame_xy(pix, smppf, flagdone)
|
||||
case(1)
|
||||
call make_a_frame_bargraph(pix, smppf, flagdone)
|
||||
case(2)
|
||||
call make_a_frame_dplot(pix, smppf, flagdone)
|
||||
end select
|
||||
|
||||
call dessine_cadre(pix, 51000, 65000, 51000, marge)
|
||||
write (filename, "(a,i5.5,a)") "./F/np/", iter, ".pnm"
|
||||
call rgbpix_spit_as_pnm_16(pix, filename)
|
||||
|
||||
@@ -60,13 +71,17 @@ program soundscope
|
||||
exit
|
||||
endif
|
||||
|
||||
if (iter .EQ. 360) exit
|
||||
|
||||
enddo
|
||||
|
||||
write(0, *) " [done]"
|
||||
|
||||
contains
|
||||
!-- ------------------------------------------------------------------
|
||||
!--
|
||||
!-
|
||||
! This is the classic Lissajou
|
||||
!-
|
||||
|
||||
subroutine make_a_frame_xy(image, nbdata, jobdone)
|
||||
type(t_pixrgb), intent(inout) :: image(:,:)
|
||||
@@ -88,15 +103,16 @@ subroutine make_a_frame_xy(image, nbdata, jobdone)
|
||||
endif
|
||||
|
||||
! add flash !
|
||||
if ( (idx .LT. 100) .AND. &
|
||||
((abs(vl).GT.21000).OR.(abs(vr).GT.21000)) ) then
|
||||
write(0,*) "overshoot!"
|
||||
if ( (idx .LT. 50) .AND. &
|
||||
((abs(vl).GT.overtrig).OR.(abs(vr).GT.overtrig)) ) then
|
||||
write(0,*) "overshoot in xy!"
|
||||
call fill_random_gauss(image, 65000, marge)
|
||||
endif
|
||||
|
||||
! scale it to the window
|
||||
ix = width - ((2 * int(vl / 111.111)) + 400)
|
||||
iy = (2 * int(vr / 166.666)) + 300
|
||||
ix = int((vl/65536.9) * real(width)) + width/2
|
||||
ix = width - ix
|
||||
iy = int((vr/65536.9) * real(height)) + height/2
|
||||
if (is_pixel_inside(ix, iy)) then
|
||||
call make_big_dot(image, ix, iy)
|
||||
endif
|
||||
@@ -105,9 +121,73 @@ subroutine make_a_frame_xy(image, nbdata, jobdone)
|
||||
end subroutine
|
||||
|
||||
!-- ------------------------------------------------------------------
|
||||
!-- ------------------------------------------------------------------
|
||||
!--
|
||||
! new: Sat Jan 6 00:04:23 UTC 2024
|
||||
!-
|
||||
! TODO bien calculer la largeur et la position des vumetres !
|
||||
!-
|
||||
! Largeur utile : largeur ecran moins deux fois la marge
|
||||
|
||||
subroutine make_a_frame_bargraph(image, nbdata, jobdone)
|
||||
type(t_pixrgb), intent(inout) :: image(:,:)
|
||||
integer, intent(in) :: nbdata
|
||||
logical, intent(out) :: jobdone
|
||||
integer :: idx, errcode
|
||||
integer :: ir, il, foo
|
||||
integer :: sigma_l, sigma_r
|
||||
integer :: largutil, haututil, xpos, ypos
|
||||
|
||||
sigma_l = 0
|
||||
sigma_r = 0
|
||||
|
||||
do idx=0, nbdata
|
||||
! get a sample
|
||||
read(5, *, iostat=errcode) il, ir
|
||||
if (0 .NE. errcode) then
|
||||
write(0, *) "iostat =", errcode
|
||||
jobdone = .TRUE.
|
||||
exit
|
||||
endif
|
||||
sigma_l = sigma_l + abs(il)
|
||||
sigma_r = sigma_r + abs(ir)
|
||||
enddo
|
||||
! ici on a lu tous les samples, on a la somme des abs()
|
||||
write(0, *) "sigmas = ", sigma_l, sigma_r
|
||||
il = sigma_l / nbdata
|
||||
ir = sigma_r / nbdata
|
||||
|
||||
call clear_image(image, marge)
|
||||
|
||||
! il ne reste plus qu'à tracer la barre.
|
||||
largutil = width - (marge*2)
|
||||
haututil = height - (marge*2)
|
||||
ypos = marge + ((il*haututil) / 32768 )
|
||||
! write(0, *) "ypos = ", ypos
|
||||
do xpos=1, largutil
|
||||
! write(0, *) " xpos", xpos
|
||||
call make_big_dot(image, xpos, ypos)
|
||||
enddo
|
||||
ypos = marge + ((il*haututil) / 32768 )
|
||||
write(0, *) "ypos = ", ypos
|
||||
do xpos=(width/2)+8, width - (marge + 8)
|
||||
write(0, *) " xpos", xpos
|
||||
call make_big_dot(image, xpos, ypos)
|
||||
enddo
|
||||
|
||||
! et ma fin de la trace : une séparation au milieu.
|
||||
do foo=marge+9, height-(marge+9)
|
||||
image(width/2, foo - 9)%r = 65500
|
||||
image(width/2, foo - 4)%r = 65500
|
||||
image(width/2, foo )%r = 65500
|
||||
image(width/2, foo + 4)%r = 65500
|
||||
image(width/2, foo + 9)%r = 65500
|
||||
enddo
|
||||
|
||||
end subroutine
|
||||
|
||||
!-- ------------------------------------------------------------------
|
||||
!-
|
||||
! THIS SUBROUTINE IS BOGUS !
|
||||
!-
|
||||
subroutine make_a_frame_dplot(image, nbdata, jobdone)
|
||||
type(t_pixrgb), intent(inout) :: image(:,:)
|
||||
integer, intent(in) :: nbdata
|
||||
@@ -129,8 +209,8 @@ subroutine make_a_frame_dplot(image, nbdata, jobdone)
|
||||
endif
|
||||
! add flash !
|
||||
if ( (idx .LT. 100) .AND. &
|
||||
((abs(vl).GT.21000).OR.(abs(vr).GT.21000)) ) then
|
||||
write(0,*) "overshoot!"
|
||||
((abs(vl).GT.overtrig).OR.(abs(vr).GT.overtrig)) ) then
|
||||
write(0,*) "overshoot in dplot!"
|
||||
call fill_random_gauss(image, 65000, marge)
|
||||
endif
|
||||
|
||||
@@ -183,7 +263,7 @@ subroutine dessine_cadre(image, R, G, B, border)
|
||||
end subroutine
|
||||
|
||||
!-- ------------------------------------------------------------------
|
||||
|
||||
!-- ------------------------------------------------------------------
|
||||
function is_pixel_inside(ix, iy)
|
||||
integer,intent(in) :: ix, iy
|
||||
logical :: is_pixel_inside
|
||||
@@ -200,8 +280,6 @@ function is_pixel_inside(ix, iy)
|
||||
|
||||
end function
|
||||
|
||||
!-- ------------------------------------------------------------------
|
||||
|
||||
|
||||
!-- ------------------------------------------------------------------
|
||||
|
||||
|
||||
7
GrafAnim/t_readpicz.sh
Executable file
7
GrafAnim/t_readpicz.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
tga_mires mircol0 mire.tga "Fortran Moderne"
|
||||
|
||||
tga_to_text foo.tga | ./readpicz
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
! -------------------------------------------------------------------
|
||||
|
||||
module utils_ga
|
||||
|
||||
use pixrgb
|
||||
implicit none
|
||||
|
||||
@@ -33,7 +34,25 @@ subroutine increment_pixel(pix, k)
|
||||
type(t_pixrgb), intent(inout) :: pix
|
||||
integer :: k
|
||||
|
||||
pix%r = pix%r + k
|
||||
pix%g = pix%g + k
|
||||
pix%b = pix%b + k
|
||||
|
||||
end subroutine
|
||||
! -------------------------------------------------------------------
|
||||
subroutine make_bar_dot(image, ix, iy)
|
||||
type(t_pixrgb), intent(inout) :: image(:,:)
|
||||
integer, intent(in) :: ix, iy
|
||||
integer :: foo
|
||||
|
||||
do foo=-1, 1
|
||||
image(ix+foo, iy)%r = 45000
|
||||
image(ix+foo, iy)%g = 5000
|
||||
image(ix+foo, iy)%b = 45000
|
||||
enddo
|
||||
image(ix-2, iy)%g = 45000
|
||||
image(ix , iy)%g = 65500
|
||||
image(ix+2, iy)%g = 45000
|
||||
|
||||
end subroutine
|
||||
! -------------------------------------------------------------------
|
||||
@@ -104,6 +123,25 @@ subroutine dim_pix_rgb_sub(pix, k)
|
||||
enddo
|
||||
enddo
|
||||
|
||||
end subroutine
|
||||
! -------------------------------------------------------------------
|
||||
subroutine clear_image(image, border)
|
||||
|
||||
type(t_pixrgb), intent(inout) :: image(:,:)
|
||||
integer, intent(in) :: border
|
||||
integer :: ix, iy
|
||||
|
||||
! write(0, *) "dim 1 =", ubound(image, 1)
|
||||
! write(0, *) "dim 2 =", ubound(image, 2)
|
||||
|
||||
do ix=1+border, ubound(image, 1)-border
|
||||
do iy=1+border, ubound(image, 2)-border
|
||||
image(ix, iy)%r = 5555
|
||||
image(ix, iy)%g = 0
|
||||
image(ix, iy)%b = 0
|
||||
enddo
|
||||
enddo
|
||||
|
||||
end subroutine
|
||||
! -------------------------------------------------------------------
|
||||
|
||||
|
||||
5
Modules/.gitignore
vendored
5
Modules/.gitignore
vendored
@@ -1,7 +1,10 @@
|
||||
|
||||
chkpixels
|
||||
t
|
||||
twavm
|
||||
trnd
|
||||
t_centermag
|
||||
|
||||
datas/
|
||||
|
||||
*.pgm
|
||||
*.pnm
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
GFOPT = -Wall -Wextra -g -I.
|
||||
|
||||
all: chkpixels trnd t
|
||||
all: chkpixels trnd twavm
|
||||
|
||||
# ---------------------------------------------------------
|
||||
|
||||
@@ -31,26 +31,37 @@ mathstuff2.o: mathstuff2.f90 Makefile
|
||||
noisepictures.o: noisepictures.f90 Makefile
|
||||
gfortran $(GFOPT) -c $<
|
||||
|
||||
# new: Wed Feb 7 01:27:48 UTC 2024
|
||||
wavmetrics.o: wavmetrics.f90 Makefile
|
||||
gfortran $(GFOPT) -c $<
|
||||
|
||||
#----------------------------------------------------------
|
||||
# making a fluffy archive
|
||||
#
|
||||
OBJECTS = spitpgm.o pixrgb.o \
|
||||
centermag.o dummy.o \
|
||||
trials.o mathstuff2.o \
|
||||
noisepictures.o
|
||||
noisepictures.o wavmetrics.o
|
||||
|
||||
libtth90modules.a: $(OBJECTS) Makefile
|
||||
$(AR) rs $@ $?
|
||||
|
||||
# please explain the 'ar' command line
|
||||
|
||||
#----------------------------------------------------------
|
||||
# programmes de testouille
|
||||
#
|
||||
|
||||
chkpixels: chkpixels.f90 Makefile libtth90modules.a
|
||||
gfortran $(GFOPT) $< libtth90modules.a -o $@
|
||||
gfortran $(GFOPT) -pg $< libtth90modules.a -o $@
|
||||
|
||||
t: t.f90 Makefile libtth90modules.a
|
||||
t_centermag: t_centermag.f90 Makefile libtth90modules.a
|
||||
gfortran $(GFOPT) $< libtth90modules.a -o $@
|
||||
|
||||
trnd: trnd.f90 Makefile libtth90modules.a
|
||||
gfortran $(GFOPT) $< libtth90modules.a -o $@
|
||||
|
||||
# new: Wed Feb 7 01:27:48 UTC 2024
|
||||
twavm: twavm.f90 Makefile libtth90modules.a
|
||||
gfortran $(GFOPT) $< libtth90modules.a -o $@
|
||||
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
|
||||
## Modules disponibles
|
||||
|
||||
### wavmetrics
|
||||
|
||||
This module try to make some computations on *stereo* buffers.
|
||||
|
||||
This is just a [WIP](./wavmetrics.f90), see [twavm](./twavm.f90) for a no-use case.
|
||||
|
||||
### spitpgm
|
||||
|
||||
@@ -11,8 +16,7 @@ Write gray level 2d buffer (aka picture) to disk in the NetPNM format.
|
||||
### pixrgb
|
||||
|
||||
Write 8 bits or 16 bits RGB pictures to PNM format.
|
||||
|
||||
**Warning!** The width of the picture MUST be a multiple of 4 !
|
||||
The width of the picture MUST be a multiple of 4 !
|
||||
|
||||
### trials
|
||||
|
||||
@@ -26,11 +30,13 @@ or have a sane place to put a breakpoint with gdb
|
||||
|
||||
## Compiler un module
|
||||
|
||||
You can use the same options as for a main program.
|
||||
*You can use the same options as for a main program.
|
||||
And when you use the module, you have to specify the paths
|
||||
for the .mod and the .o to the linker.
|
||||
*
|
||||
|
||||
See [Makefile](./Makefile) for an example.
|
||||
|
||||
## TODO
|
||||
|
||||
- écrire la doc !
|
||||
- write the fscking doc !
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
module centermag
|
||||
implicit none
|
||||
!-----------------------------------------------------------------------
|
||||
!-
|
||||
! By definition, the default centermax (0, 0, 1) give us a
|
||||
! (-1,-1), (1, 1) box, who is mapped to the screen size.
|
||||
!-
|
||||
!-----------------------------------------------------------------------
|
||||
! definition of structures
|
||||
!-
|
||||
type t_centermag
|
||||
@@ -13,16 +18,30 @@ type t_centermag
|
||||
end type
|
||||
!-------------------------------------------------------------------
|
||||
contains
|
||||
!-------------------------------------------------------------------
|
||||
subroutine init_centermag(cntmag, w, h, mag)
|
||||
type(t_centermag),intent(out) :: cntmag
|
||||
integer, intent(in) :: w, h ! screen size
|
||||
real, intent(in) :: mag
|
||||
|
||||
write(0, *) ">>> init centermag:", w, h
|
||||
|
||||
cntmag%wscr = w ; cntmag%hscr = h
|
||||
cntmag%mag = mag
|
||||
|
||||
end subroutine
|
||||
|
||||
!-------------------------------------------------------------------
|
||||
subroutine print_centermag (cm)
|
||||
type(t_centermag), intent(in) :: cm
|
||||
|
||||
print *, "Screen ", cm%wscr, cm%hscr
|
||||
print *, "MagFactor ", cm%mag
|
||||
print *, "Center ", cm%cx, cm%cy
|
||||
! print *, "Center ", cm%cx, cm%cy
|
||||
|
||||
end subroutine
|
||||
!-------------------------------------------------------------------
|
||||
!-------------------------------------------------------------------
|
||||
subroutine centermag_scr2real (sx, sy, rx, ry)
|
||||
integer, intent(in) :: sx, sy
|
||||
real, intent(out) :: rx, ry
|
||||
|
||||
6
Modules/farbfeld.f90
Normal file
6
Modules/farbfeld.f90
Normal file
@@ -0,0 +1,6 @@
|
||||
!-
|
||||
!-
|
||||
! https://linuxfr.org/users/devnewton/liens/farbfeld-le-format-d-image-le-plus-simple-du-monde
|
||||
! http://tools.suckless.org/farbfeld/
|
||||
!-
|
||||
|
||||
@@ -6,15 +6,15 @@ module mathstuff2
|
||||
implicit none
|
||||
contains
|
||||
|
||||
! ----------------------------------------------------------------
|
||||
! really quick'n'dirty hack
|
||||
! not really tested yet...
|
||||
|
||||
! ----------------------------------------------------------------
|
||||
! really quick'n'dirty hack
|
||||
! not really tested yet...
|
||||
subroutine init_random_seed()
|
||||
|
||||
integer, dimension(3) :: tarray
|
||||
integer :: t3, foo
|
||||
real :: dummy
|
||||
|
||||
call itime(tarray)
|
||||
t3 = 3600*tarray(1) + 60*tarray(2) + tarray(3)
|
||||
! write(0, '(A,3I3,A,I6)') "sranding: ", tarray, " --> ", t3
|
||||
@@ -28,8 +28,10 @@ module mathstuff2
|
||||
|
||||
end subroutine
|
||||
|
||||
! ----------------------------------------------------------------
|
||||
|
||||
! ----------------------------------------------------------------
|
||||
!-
|
||||
!- May be I can make some generic procedures ?
|
||||
!-
|
||||
logical function diff_sign(a, b)
|
||||
integer, intent(in) :: a, b
|
||||
|
||||
@@ -45,8 +47,6 @@ logical function diff_sign(a, b)
|
||||
diff_sign = .FALSE.
|
||||
|
||||
end function
|
||||
|
||||
|
||||
! ----------------------------------------------------------------
|
||||
! ----------------------------------------------------------------
|
||||
end module mathstuff2
|
||||
|
||||
|
||||
@@ -116,12 +116,14 @@ end subroutine
|
||||
!-
|
||||
! CAUTION: there was NO out-of-bounds check !
|
||||
!-
|
||||
! The width of the picture MUST be a multiple of 4 !
|
||||
!-
|
||||
subroutine rgbpix_spit_as_pnm_16(pic, fname)
|
||||
|
||||
type(t_pixrgb), intent(in) :: pic(:,:)
|
||||
character (len=*), intent(in) :: fname
|
||||
|
||||
integer :: io, ix, iy, ik
|
||||
integer :: io, ix, iy
|
||||
integer :: buffer(3*4), ptr
|
||||
|
||||
! write(0, *) ">>> subroutine rgbpix_spit_as_pnm_16"
|
||||
@@ -150,7 +152,7 @@ subroutine rgbpix_spit_as_pnm_16(pic, fname)
|
||||
enddo ! write(io, *) " fin iy=", iy
|
||||
enddo
|
||||
|
||||
! may be we have to flush the buffer ?
|
||||
! XXX may be we have to flush our internal buffer ?
|
||||
|
||||
close(unit=io)
|
||||
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
program t
|
||||
|
||||
use centermag
|
||||
implicit none
|
||||
|
||||
type(t_centermag) :: cmag
|
||||
|
||||
print *, '====== programme de test ======'
|
||||
|
||||
cmag%wscr = 800
|
||||
cmag%hscr = 600
|
||||
|
||||
print *, '====== programme de test centermag ======'
|
||||
call essai_centermag(cmag)
|
||||
print *
|
||||
|
||||
@@ -19,15 +13,13 @@ program t
|
||||
contains
|
||||
! --------------
|
||||
subroutine essai_centermag(cm)
|
||||
type(t_centermag), intent(in) :: cm
|
||||
|
||||
real :: rx, ry
|
||||
type(t_centermag), intent(inout) :: cm
|
||||
real :: rx, ry
|
||||
|
||||
call init_centermag(cm, 800, 600, 1.0)
|
||||
call print_centermag (cm)
|
||||
print *
|
||||
|
||||
call centermag_scr2real(1, 1, rx, ry)
|
||||
print *, 'to real :', rx, ry
|
||||
rx = 0.45 ; ry = -1.098
|
||||
|
||||
end subroutine
|
||||
! --------------
|
||||
11
Modules/test-wavm.sh
Executable file
11
Modules/test-wavm.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
WAVE="datas/wave.wav"
|
||||
|
||||
# sndfile-info ${WAVE}
|
||||
|
||||
echo
|
||||
|
||||
wav2text ${WAVE} | ./twavm
|
||||
|
||||
echo
|
||||
67
Modules/twavm.f90
Normal file
67
Modules/twavm.f90
Normal file
@@ -0,0 +1,67 @@
|
||||
program twavm
|
||||
|
||||
! new: Wed Feb 7 01:27:48 UTC 2024
|
||||
|
||||
use mathstuff2
|
||||
use wavmetrics
|
||||
implicit none
|
||||
|
||||
write(0, *) "----------------- twavm -------------------"
|
||||
|
||||
call run_second_test(44100/30)
|
||||
|
||||
contains
|
||||
!-----------------------------------------------------------------------
|
||||
|
||||
subroutine run_first_test(nbs)
|
||||
integer, intent(in) :: nbs ! nombre d'echantillons
|
||||
|
||||
type(intsample), allocatable :: samples(:)
|
||||
type(wavmetric) :: metrics
|
||||
integer :: foo, bar
|
||||
|
||||
write(0, '(1X, "first test on ", I0, " samples.")') nbs
|
||||
|
||||
! create the buffer, and fill it with garbage
|
||||
allocate(samples(nbs))
|
||||
do foo=1, nbs
|
||||
samples(foo)%left = mod(irand(), 65534) - 32700
|
||||
samples(foo)%right = mod(irand(), 60000) - 29999
|
||||
enddo
|
||||
|
||||
! compute and display the metrics (gi-go)
|
||||
call compute_wavmetric(samples, nbs, metrics)
|
||||
call display_wavmetrics(metrics)
|
||||
|
||||
end subroutine
|
||||
!-----------------------------------------------------------------------
|
||||
!-----------------------------------------------------------------------
|
||||
!-
|
||||
!- we read the datas from stdin
|
||||
!-
|
||||
subroutine run_second_test(nbs)
|
||||
integer, intent(in) :: nbs ! nombre d'echantillons
|
||||
|
||||
type(intsample), allocatable :: samples(:)
|
||||
type(wavmetric) :: metrics
|
||||
integer :: foo, bar
|
||||
integer :: vl, vr
|
||||
|
||||
write(0, '(1X, "second test on ", I0, " samples.")') nbs
|
||||
|
||||
! create the buffer, and fill it with stdin
|
||||
allocate(samples(nbs))
|
||||
do foo=1, nbs
|
||||
read(5, *) vl, vr
|
||||
! print '(1X, 2I16)', vl, vr
|
||||
samples(foo)%left = vl
|
||||
samples(foo)%right = vr
|
||||
enddo
|
||||
|
||||
! compute and display the metrics (gi-go)
|
||||
call compute_wavmetric(samples, nbs, metrics)
|
||||
call display_wavmetrics(metrics)
|
||||
|
||||
end subroutine
|
||||
!-----------------------------------------------------------------------
|
||||
end program
|
||||
85
Modules/wavmetrics.f90
Normal file
85
Modules/wavmetrics.f90
Normal file
@@ -0,0 +1,85 @@
|
||||
|
||||
module wavmetrics
|
||||
|
||||
! new: Thu Jan 4 00:08:04 UTC 2024
|
||||
|
||||
use mathstuff2
|
||||
implicit none
|
||||
|
||||
type wavmetric
|
||||
integer :: nbre ! number of slices/samples
|
||||
real :: freql, freqr ! zero-crossing estimation
|
||||
integer :: maxl, maxr ! maximum of abs values
|
||||
real :: meanl, meanr
|
||||
end type
|
||||
|
||||
type intsample
|
||||
integer :: left, right
|
||||
end type
|
||||
|
||||
contains
|
||||
!-------------------------------------------------------------
|
||||
!-
|
||||
! main computation routine, still full buggy
|
||||
!-
|
||||
subroutine compute_wavmetric(samples, size, metrics)
|
||||
type(intsample), intent(in) :: samples(:)
|
||||
integer, intent(in) :: size
|
||||
type(wavmetric), intent(out) :: metrics
|
||||
|
||||
integer :: Lmax, Rmax
|
||||
integer :: Lval, Rval
|
||||
integer :: idx
|
||||
integer :: Lfreq, Rfreq
|
||||
|
||||
real :: Lsum, Rsum
|
||||
|
||||
Lmax = 0 ; Rmax = 0
|
||||
Lfreq = 1 ; Rfreq = 1
|
||||
Lsum = 0.0 ; Rsum = 0.0
|
||||
|
||||
do idx=1, size
|
||||
Lval = samples(idx)%left
|
||||
Rval = samples(idx)%right
|
||||
|
||||
! print *, Rval, Lval
|
||||
if (abs(Lval) .GT. Lmax) Lmax = abs(Lval)
|
||||
if (abs(Rval) .GT. Rmax) Rmax = abs(Rval)
|
||||
|
||||
if (idx .GT. 1) then
|
||||
if (diff_sign(samples(idx-1)%left, Lval)) Lfreq = Lfreq + 1
|
||||
if (diff_sign(samples(idx-1)%right, Rval)) Rfreq = Rfreq + 1
|
||||
endif
|
||||
|
||||
Lsum = Lsum + Lval
|
||||
Rsum = Rsum + Rval
|
||||
|
||||
enddo
|
||||
|
||||
metrics%nbre = size
|
||||
metrics%maxl = Lmax ; metrics%maxr = Rmax
|
||||
metrics%freql = 1.0 / (Lfreq / real(size))
|
||||
metrics%freqr = 1.0 / (Rfreq / real(size))
|
||||
metrics%meanl = Lsum / real(size)
|
||||
metrics%meanr = Rsum / real(size)
|
||||
|
||||
end subroutine
|
||||
|
||||
!-------------------------------------------------------------
|
||||
|
||||
subroutine display_wavmetrics(metrics)
|
||||
type(wavmetric), intent(in) :: metrics
|
||||
|
||||
! print '(1X, "metrics are :")'
|
||||
|
||||
print '(1X, " | nbre ", I0)', metrics%nbre
|
||||
print '(1X, " | freq ", 2F12.2)', metrics%freql, metrics%freqr
|
||||
print '(1X, " | mean ", 2F12.2)', metrics%meanl, metrics%meanr
|
||||
print '(1X, " | maxi ", 2I8)', metrics%maxl, metrics%maxr
|
||||
|
||||
end subroutine
|
||||
|
||||
!-------------------------------------------------------------
|
||||
!-------------------------------------------------------------
|
||||
|
||||
end module
|
||||
18
README.md
18
README.md
@@ -8,21 +8,31 @@ de Janvier 2022, et j'ai bien aimé. Bon, contrairement à la
|
||||
version de 77, les `GOTO`s sont moins agréables à faire, mais
|
||||
l'existence des _pointeurs_ compense largement.
|
||||
|
||||
## content
|
||||
## Le contenu
|
||||
|
||||
- [Modules](Modules/) : quelques composants de base.
|
||||
- [SoundBrotching](SoundBrotching/) : faire gémir vos tympans
|
||||
- [BloubWorld](BloubWorld/) : la vie des particules
|
||||
- [Fraktalism](Fraktalism/) : du chaos dans les pixels
|
||||
- [RandomStuff](RandomStuff/) : on a tous droit à notre jardin secret
|
||||
- [GrafAnim](GrafAnim/) : Ah, enfin de la gif89a en vue !
|
||||
|
||||
## Prérequis
|
||||
## Utilisation
|
||||
|
||||
- GNUtrucs : bash, make, awk...
|
||||
- Prérequis de base, les GNUtrucs : gfortran, gcc, bash, make, awk...
|
||||
- Première chose à faire, compiler les [modules](Modules/README.md)
|
||||
qui seront utilisés par les autres logiciels.
|
||||
- Et ensuite, à vous de jouer. Fouillez dans les dossiers en sachant
|
||||
bien que beaucoup de ces trucs ne sont ni fait, ni à faire.
|
||||
|
||||
## hotline
|
||||
## Hotline
|
||||
|
||||
- Le canal `#tetalab` sur le réseau IRC de
|
||||
[Libera](https://libera.chat/)
|
||||
- La [mailing-list publique](https://lists.tetalab.org/mailman/listinfo/tetalab) du Tetalab.
|
||||
|
||||
## Ressources
|
||||
|
||||
* [Fortran Programming Language](https://fortran-lang.org/)
|
||||
* [Fortran Tips](https://zmoon.github.io/FortranTipBrowser/tips/index.html)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# tth@konrad:~/Devel/Fortraneries/SoundBrotching/c-tools$
|
||||
#
|
||||
|
||||
COPT = -Wall -Wextra -g -DDEBUG_LEVEL=1
|
||||
COPT = -std=c11 -Wall -Wextra -g -DDEBUG_LEVEL=1
|
||||
|
||||
all: text2wav wav2text text2ao
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ Support utilities for SoundBrotching.
|
||||
|
||||
Conversion d'un fichier son en texte machinable, actuellement
|
||||
en *space separated*, directement utilisable par `Awk`.
|
||||
Un export `csv` est planifié. Ce prgramme ne prend
|
||||
Un export `csv` est planifié. Ce programme ne prend
|
||||
pas (encore) d'options.
|
||||
|
||||
Usage : `wav2txt 1337.wav > fichier.txt`
|
||||
@@ -14,6 +14,8 @@ Usage : `wav2txt 1337.wav > fichier.txt`
|
||||
### text2wav
|
||||
|
||||
Conversion d'un fichier texte en fichier son.
|
||||
En principe, réalise l'opération inverse de celle que
|
||||
fait *wav2text*.
|
||||
|
||||
### text2ao
|
||||
|
||||
|
||||
Reference in New Issue
Block a user