From c2d6abdedbda26a5de2f0c038a270490a0e0682d Mon Sep 17 00:00:00 2001 From: tTh Date: Sun, 7 May 2023 23:48:37 +0200 Subject: [PATCH] more useless work done --- Modules/.gitignore | 2 ++ Modules/Makefile | 29 ++++++++++++++++++++++------- Modules/README.md | 21 ++++++++++++++++++--- Modules/t.f90 | 35 +++++++++++++++++++++++++++++++++++ Modules/trnd.f90 | 21 +++++++++++++++++++++ 5 files changed, 98 insertions(+), 10 deletions(-) create mode 100644 Modules/t.f90 create mode 100644 Modules/trnd.f90 diff --git a/Modules/.gitignore b/Modules/.gitignore index 4aafacb..4d3cb06 100644 --- a/Modules/.gitignore +++ b/Modules/.gitignore @@ -1,5 +1,7 @@ chkpixels +t +trnd *.pgm *.pnm diff --git a/Modules/Makefile b/Modules/Makefile index 06c4cac..0923f72 100644 --- a/Modules/Makefile +++ b/Modules/Makefile @@ -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 $@ diff --git a/Modules/README.md b/Modules/README.md index 4ee7f64..5d37577 100644 --- a/Modules/README.md +++ b/Modules/README.md @@ -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 ! diff --git a/Modules/t.f90 b/Modules/t.f90 new file mode 100644 index 0000000..e2d520d --- /dev/null +++ b/Modules/t.f90 @@ -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 diff --git a/Modules/trnd.f90 b/Modules/trnd.f90 new file mode 100644 index 0000000..a520c3e --- /dev/null +++ b/Modules/trnd.f90 @@ -0,0 +1,21 @@ +program essai + + use mathstuff2 + implicit none + + integer :: foo, bar + real :: quux + double precision :: somme + + write(0, *) "----------------- essai -------------------" + + call init_random_seed() ! in module 'mathstuff' + somme = 0.0 + do foo=1, 500 + quux = rand() + rand() + somme = somme + quux + bar = mod(irand(), 7) + print *, foo, quux, somme/foo, bar + enddo + +end program