Observatoire de Paris - Code Fortran  version1.0
mod_initialise.f90
Aller à la documentation de ce fichier.
1 
2 !-----------------------------------------
3 ! FILE HEADER
4 !-----------------------------------------
5 ! TITLE : cours Doxygen
6 ! PROJECT : module use
7 ! MODULE : mod_initialise.f90
8 ! URL : ...
9 ! AFFILIATION : Observatoire
10 ! DATE : ...
11 ! REVISION : ... V 0.8
31 !--------------------------------------------
33  use mod_mat
34 implicit none
35 
44 type initvar
45 
46  integer :: n_size
47  integer :: m_size
48  integer :: i_ind
49 contains
50  PROCEDURE :: initarray =>inita
51  PROCEDURE :: cleanarray =>setzero
52 end type
53 
54 
55 contains
63 subroutine inita(n,a)
64  implicit none ! on force l'initialisation de toutes les variables
65  integer, intent(in) :: n ! On specifie le role des arguments
66  real(kind=kind(1.d0)), intent(inout) :: a(n,n)
67  integer :: i,j
68  real(kind=kind(1.d0)) :: r
69 
70  r = exp(2.)+10.
71  do j = 1,n
72  r = r + real(j)
73  a(:,j) = r
74  end do
75 
76 end subroutine inita
77 
85 subroutine setzero(n,a)
86  implicit none ! on force l'initialisation de toutes les variables
87  integer, intent(in) :: n ! On specifie le role des arguments
88  real(kind=kind(1.d0)), intent(inout) :: a(n,n)
89 
90  a=0
91 end subroutine setzero
98 subroutine initb(n,b)
99  implicit none ! on force l'initialisation de toutes les variables
100  integer, intent(in) :: n
101  real(kind=kind(1.d0)), intent(inout) :: b(n,n)
102  integer :: i,j
103  real(kind=kind(1.d0)) :: rj,dj,ri,d
104 
105  do j = 1,n/2-1
106  rj = real(j)
107  dj = (0.9 + (0.001 + 0.05*rj)*rj)*rj
108  do i = 1,n
109  ri = real(i)
110  b(i,j) = 0.2 + (0.3 + (0.4 + 0.01*ri)*ri)*ri - dj
111  end do
112  end do
113 
114  d = 1./6.
115  do j = n/2,n
116  dj = real(j)*0.1
117  do i = 1,n
118  b(i,j) = i*d + dj
119  end do
120  end do
121 
122 end subroutine initb
123 
124 
128 subroutine initx(n,x)
129  implicit none ! on force l'initialisation de toutes les variables
130  integer, intent(in) :: n
131  real(kind=kind(1.d0)), intent(out) :: x(n)
132  integer :: i
133  real(kind=kind(1.d0)) :: d
134 
135  d = 0.4/7.
136  do i = 1,n,4
137  x(i) = real(i)*d
138  x(i+1) = real(i+1)*d
139  x(i+2) = real(i+2)*d
140  x(i+3) = real(i+3)*d
141  end do
142 
143 end subroutine initx
144 
145 subroutine to_test(n,a,b)
146 integer, intent(in) :: n
147  real(kind=kind(1.d0)), intent(in) :: a(n)
148  real(kind=kind(1.d0)), intent(out) ::b
149  b=a
150  call initx(n,b)
151  end subroutine to_test
152 
153 end module initialise
subroutine to_test(n, a, b)
subroutine setzero(n, a)
subroutine initb(n, b)
subroutine inita(n, a)
subroutine initx(n, x)
X initialization.