Compare commits
4 Commits
aace571169
...
c2d6abdedb
Author | SHA1 | Date |
---|---|---|
tTh | c2d6abdedb | |
tTh | c47b99bf7d | |
tTh | 5c4ff9133c | |
tTh | 9366c67c4b |
|
@ -21,7 +21,8 @@ trigofest: trigofest.f90 Makefile vue3axes.o utils_ga.o
|
|||
utils_ga.o -o $@
|
||||
|
||||
noisepic: noisepic.f90 Makefile
|
||||
gfortran $(GFOPT) $< ../Modules/spitpgm.o -o $@
|
||||
gfortran $(GFOPT) $< ../Modules/spitpgm.o ../Modules/pixrgb.o \
|
||||
-o $@
|
||||
|
||||
# ---- modules locaux
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
program noisepic
|
||||
|
||||
use spitpgm
|
||||
use pixrgb
|
||||
implicit none
|
||||
|
||||
integer :: numframe = 0
|
||||
|
@ -16,12 +17,15 @@ program noisepic
|
|||
read (arg, *) numframe
|
||||
endif
|
||||
|
||||
call make_noise_pic(numframe)
|
||||
call make_noise_color_pic(numframe)
|
||||
|
||||
contains
|
||||
!-- ------------------------------------------------------------------
|
||||
subroutine make_noise_pic (value)
|
||||
|
||||
!-
|
||||
!- Black & White
|
||||
!-
|
||||
subroutine make_noise_bw_pic (value)
|
||||
implicit none
|
||||
integer, intent(in) :: value
|
||||
|
||||
integer :: foo
|
||||
|
@ -30,20 +34,20 @@ subroutine make_noise_pic (value)
|
|||
|
||||
allocate(pic(320, 240))
|
||||
|
||||
pic = 0
|
||||
pic = 30 !- clear the picz
|
||||
|
||||
call srand(value+34)
|
||||
foo = irand()
|
||||
print *, 'val=', value, ' rnd=', foo
|
||||
|
||||
call plot_noise_pic(pic, 15000)
|
||||
call plot_noise_bw_pic(pic, 15000)
|
||||
|
||||
write (filename, "(a, i5.5, a)") "", value, ".pgm"
|
||||
call spit_as_pgm_8(pic, trim(filename))
|
||||
|
||||
end subroutine
|
||||
!-- ------------------------------------------------------------------
|
||||
subroutine plot_noise_pic(picz, nbre)
|
||||
subroutine plot_noise_bw_pic(picz, nbre)
|
||||
implicit none
|
||||
|
||||
integer, dimension(:,:), intent(inout) :: picz
|
||||
integer, intent(in) :: nbre
|
||||
|
@ -51,23 +55,63 @@ subroutine plot_noise_pic(picz, nbre)
|
|||
integer :: width, height
|
||||
integer :: quux, ix, iy, iv
|
||||
|
||||
|
||||
width = ubound(picz, 1) ; height = ubound(picz, 2)
|
||||
! print *, 'sz picz', width, height
|
||||
|
||||
do quux=1, nbre
|
||||
|
||||
ix = 1 + mod ( irand(), width )
|
||||
iy = 1 + mod ( irand(), height )
|
||||
iv = mod ( irand(), 256 )
|
||||
|
||||
! print *, ix, iy
|
||||
picz(ix, iy) = iv
|
||||
enddo
|
||||
end subroutine
|
||||
|
||||
!-- ------------------------------------------------------------------
|
||||
!-
|
||||
!- Colorized
|
||||
!-
|
||||
subroutine make_noise_color_pic (value)
|
||||
implicit none
|
||||
integer, intent(in) :: value
|
||||
|
||||
integer :: foo
|
||||
type(t_pixrgb), dimension(:,:), allocatable :: pix
|
||||
character (len=280) :: filename
|
||||
|
||||
allocate(pix(320, 240))
|
||||
call rgbpix_set_to_rgb(pix, 30, 30, 60)
|
||||
|
||||
call srand(value+34)
|
||||
foo = irand()
|
||||
print *, 'val=', value, ' rnd=', foo
|
||||
|
||||
call plot_noise_color_pic(pix, 15000)
|
||||
|
||||
write (filename, "(a, i5.5, a)") "./", value, ".pnm"
|
||||
call rgbpix_spit_as_pnm_8(pix, trim(filename))
|
||||
|
||||
end subroutine
|
||||
!-- ------------------------------------------------------------------
|
||||
|
||||
subroutine plot_noise_color_pic(prgb, nbre)
|
||||
implicit none
|
||||
type(t_pixrgb), dimension(:,:), intent(inout) :: prgb
|
||||
integer, intent(in) :: nbre
|
||||
integer :: quux, ix, iy, width, height
|
||||
|
||||
width = ubound(prgb, 1) ; height = ubound(prgb, 2)
|
||||
|
||||
do quux=1, nbre
|
||||
ix = 1 + mod ( irand(), width )
|
||||
iy = 1 + mod ( irand(), height )
|
||||
prgb(ix, iy)%r = 64 + mod ( irand(), 127 )
|
||||
prgb(ix, iy)%g = 64 + mod ( irand(), 127 )
|
||||
prgb(ix, iy)%b = 64 + mod ( irand(), 127 )
|
||||
|
||||
enddo
|
||||
|
||||
end subroutine
|
||||
|
||||
!-- ------------------------------------------------------------------
|
||||
|
||||
end program
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
|
||||
chkpixels
|
||||
t
|
||||
trnd
|
||||
|
||||
*.pgm
|
||||
*.pnm
|
||||
|
|
|
@ -1,29 +1,44 @@
|
|||
#
|
||||
# * Fortraneries *
|
||||
# * Fortraneries from tTh *
|
||||
#
|
||||
# Makefile for the general purpose moduls
|
||||
#
|
||||
|
||||
GFOPT = -Wall -Wextra -time -g
|
||||
GFOPT = -Wall -Wextra -g -I.
|
||||
|
||||
all: chkpixels
|
||||
all: chkpixels t
|
||||
|
||||
# -----------------------------------------------
|
||||
|
||||
spitpgm.o: spitpgm.f90 Makefile
|
||||
gfortran $(GFOPT) -c $< -o $@
|
||||
gfortran $(GFOPT) -c $<
|
||||
|
||||
pixrgb.o: pixrgb.f90 Makefile
|
||||
gfortran $(GFOPT) -c $< -o $@
|
||||
gfortran $(GFOPT) -c $<
|
||||
|
||||
centermag.o: centermag.f90 Makefile
|
||||
gfortran $(GFOPT) -c $<
|
||||
|
||||
dummy.o: dummy.f90 Makefile
|
||||
gfortran $(GFOPT) -c $<
|
||||
|
||||
trials.o: trials.f90 Makefile
|
||||
gfortran $(GFOPT) -c $< -o $@
|
||||
gfortran $(GFOPT) -c $<
|
||||
|
||||
mathstuff2.o: mathstuff2.f90 Makefile
|
||||
gfortran $(GFOPT) -c $<
|
||||
|
||||
#
|
||||
# programmes de testouille
|
||||
#
|
||||
OBJS = trials.o spitpgm.o pixrgb.o
|
||||
OBJS = trials.o spitpgm.o pixrgb.o centermag.o dummy.o \
|
||||
mathstuff2.o
|
||||
|
||||
chkpixels: chkpixels.f90 Makefile $(OBJS)
|
||||
gfortran $(GFOPT) $< $(OBJS) -o $@
|
||||
|
||||
t: t.f90 Makefile $(OBJS)
|
||||
gfortran $(GFOPT) $< $(OBJS) -o $@
|
||||
|
||||
trnd: trnd.f90 Makefile $(OBJS)
|
||||
gfortran $(GFOPT) $< $(OBJS) -o $@
|
||||
|
|
|
@ -1,14 +1,29 @@
|
|||
# General purpose modules
|
||||
|
||||
## Compiler un module
|
||||
|
||||
## spitpgm
|
||||
Mmmmm...
|
||||
|
||||
## Modules disponibles
|
||||
|
||||
|
||||
### spitpgm
|
||||
|
||||
Write gray level 2d buffer (aka picture) to disk in the NetPNM format.
|
||||
|
||||
## pixrgb
|
||||
### pixrgb
|
||||
|
||||
Write 8 bits RGB pictures to PNM format.
|
||||
|
||||
## trials
|
||||
### trials
|
||||
|
||||
Experimental WIPs from hell.
|
||||
|
||||
### dummy
|
||||
|
||||
A "do nothing" useless module. But you cas use it to fool an optimizing
|
||||
compiler, or have a sane place to put a breakpoint with gdb
|
||||
|
||||
## TODO
|
||||
|
||||
- écrire la doc !
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
!-
|
||||
! This module try to write PNM complient RGB files
|
||||
! ONLY ASCII MODE IS SUPPORTED !
|
||||
!-
|
||||
module pixrgb
|
||||
implicit none
|
||||
|
@ -26,6 +27,23 @@ subroutine rgbpix_set_to_zero(pic)
|
|||
enddo
|
||||
enddo
|
||||
end subroutine
|
||||
!-------------------------------------------------------------------
|
||||
!-
|
||||
! set all the pixels to a RGB value
|
||||
!-
|
||||
subroutine rgbpix_set_to_rgb(pic, r, g, b)
|
||||
type(t_pixrgb), intent(out) :: pic(:,:)
|
||||
integer, intent(in) :: r, g, b
|
||||
integer :: ix, iy
|
||||
do iy=1, ubound(pic, 2)
|
||||
do ix=1, ubound(pic, 1)
|
||||
pic(ix, iy)%r = r
|
||||
pic(ix, iy)%g = g
|
||||
pic(ix, iy)%b = b
|
||||
enddo
|
||||
enddo
|
||||
end subroutine
|
||||
|
||||
!-------------------------------------------------------------------
|
||||
!-
|
||||
! NOT TESTED !!!
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
program t
|
||||
|
||||
use centermag
|
||||
implicit none
|
||||
|
||||
type(t_centermag) :: cmag
|
||||
|
||||
print *, '====== programme de test ======'
|
||||
|
||||
cmag%wscr = 800
|
||||
cmag%hscr = 600
|
||||
|
||||
call essai_centermag(cmag)
|
||||
print *
|
||||
|
||||
STOP ': PAF LE CHIEN ?'
|
||||
|
||||
! --------------
|
||||
contains
|
||||
! --------------
|
||||
subroutine essai_centermag(cm)
|
||||
type(t_centermag), intent(in) :: cm
|
||||
|
||||
real :: rx, ry
|
||||
|
||||
call print_centermag (cm)
|
||||
print *
|
||||
|
||||
call centermag_scr2real(1, 1, rx, ry)
|
||||
print *, 'to real :', rx, ry
|
||||
|
||||
end subroutine
|
||||
! --------------
|
||||
|
||||
end program
|
|
@ -4,17 +4,13 @@
|
|||
|
||||
GFOPT = -Wall -Wextra -g -time
|
||||
|
||||
all: essai displaykinds
|
||||
all: displaykinds
|
||||
|
||||
# -----------------------------------------------------
|
||||
|
||||
mathstuff2.o: mathstuff2.f90 Makefile
|
||||
gfortran $(GFOPT) -c $<
|
||||
|
||||
# -----------------------------------------------------
|
||||
|
||||
essai: essai.f90 Makefile mathstuff2.o
|
||||
gfortran $(GFOPT) $< mathstuff2.o -o $@
|
||||
|
||||
displaykinds: displaykinds.f90 Makefile
|
||||
gfortran $(GFOPT) $< -o $@
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
module mathstuff2
|
||||
|
||||
! XXX This module was a copy of mathstuff.f90 fromthe BloubWorld
|
||||
! XXX wil be moved in an other place some day...
|
||||
|
||||
implicit none
|
||||
contains
|
||||
|
||||
! ----------------------------------------------------------------
|
||||
! 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
|
||||
call srand(t3)
|
||||
|
||||
! after initializing the random generator engine,
|
||||
! you MUST use it for initializing the initializer
|
||||
do foo=1, tarray(1)+5
|
||||
dummy = rand()
|
||||
enddo
|
||||
|
||||
end subroutine
|
||||
|
||||
! ----------------------------------------------------------------
|
||||
end module mathstuff2
|
||||
|
Loading…
Reference in New Issue