#sundaycommit

This commit is contained in:
tTh
2023-04-02 23:32:29 +02:00
parent 28c260ea5e
commit 52b7bbe6ef
8 changed files with 176 additions and 68 deletions

View File

@@ -8,7 +8,7 @@ dessiner: dessiner.f90 Makefile
gfortran -g $< $(INCS) -lplplotfortran -o $@
foo.gif: dessiner Makefile
plot89a.gif: dessiner Makefile
rm -f WS/A????.png
./dessiner
convert -delay 10 -colors 31 WS/A????.png foo.gif
convert -delay 10 -colors 42 WS/A????.png $@

5
code/fortran/README.md Normal file
View File

@@ -0,0 +1,5 @@
# Exemples de code en Fortran moderne
Pour les explications, il faut aller lire le livre ou
les codes source.

View File

@@ -13,6 +13,13 @@ program dessiner
contains ! -----------------------------
!------------------------------------------------------
!- __ __ _
!- \ \/ / __ __ (_) _ __
!- \ / \ \ /\ / / | | | '_ \
!- / \ \ V V / | | | | | |
!- /_/\_\ \_/\_/ |_| |_| |_|
!-
subroutine dessin_X11 (sha, shb, color)
real, intent(in) :: sha, shb
integer, intent(in) :: color
@@ -41,7 +48,7 @@ subroutine dessin_X11 (sha, shb, color)
call plcol0 (color)
call plline (x, y)
call plend
call plend ()
end subroutine
!------------------------------------------------------
@@ -54,7 +61,8 @@ end subroutine
subroutine dessin_dans_un_fichier ()
integer, parameter :: nbpts = 40
integer, parameter :: nbpts = 20
real, parameter :: usz = 15.0 ! univers size
real :: x(nbpts), y(nbpts)
integer :: frame, i
character(len=89) :: filename
@@ -64,11 +72,11 @@ subroutine dessin_dans_un_fichier ()
print *, 'Dessin dans un fichier'
do i=1, nbpts
x(i) = 8.50 * (rand() - 0.5000)
y(i) = 8.50 * (rand() - 0.5000)
x(i) = usz * (rand() - 0.5000)
y(i) = usz * (rand() - 0.5000) * 0.50
enddo
do frame= 0, 149
do frame= 0, 119
write (filename, "(a, i4.4, a)") "WS/A", frame, ".png"
print *, frame, ' => ', trim(filename)
call plsdev ('pngcairo')
@@ -77,8 +85,8 @@ subroutine dessin_dans_un_fichier ()
call plenv (-10., 10., -10., 10., 0, 1)
call plcol0 (3)
do i=1, nbpts
x(i) = x(i) + (rand() - 0.5000)
y(i) = y(i) + (rand() - 0.5000)
x(i) = x(i) + 1.2 * (rand() - 0.5000)
y(i) = y(i) + 1.2 * (rand() - 0.5000)
call plline (x, y)
enddo
write(buffer, "(i3.3)") frame
@@ -86,12 +94,29 @@ subroutine dessin_dans_un_fichier ()
call plcol0 (15)
call plstring (x, y, buffer)
call plend
call plend ()
enddo
end subroutine
!------------------------------------------------------
!- _ _ ____
!- | |_ _ __ ___ (_) | _ \
!- | __| | '__| / _ \ | | | | | |
!- | |_ | | | (_) | | | | |_| |
!- \__| |_| \___/ |_| |____/
!-
subroutine dessiner_en_trois_D ()
integer, parameter :: szgrid = 64
integer :: i, j
print *, 'Dessin en 3D (de merde :)'
call plsdev ('xwin')
call plinit ()
call plend ()
end subroutine
!------------------------------------------------------
end program