SPEED
GET_MINVALUES.f90
Go to the documentation of this file.
1! Copyright (C) 2012 The SPEED FOUNDATION
2! Author: Ilario Mazzieri
3!
4! This file is part of SPEED.
5!
6! SPEED is free software; you can redistribute it and/or modify it
7! under the terms of the GNU Affero General Public License as
8! published by the Free Software Foundation, either version 3 of the
9! License, or (at your option) any later version.
10!
11! SPEED is distributed in the hope that it will be useful, but
12! WITHOUT ANY WARRANTY; without even the implied warranty of
13! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14! Affero General Public License for more details.
15!
16! You should have received a copy of the GNU Affero General Public License
17! along with SPEED. If not, see <http://www.gnu.org/licenses/>.
18
29
30
31 subroutine get_minvalues(i_glo, v_glo, n_glo, i_loc, n_loc, np)
32
33
34
35 implicit none
36
37 integer*4 :: n_glo, n_loc, np
38 integer*4 :: i,j
39
40 integer*4, dimension(1) :: pos
41 integer*4, dimension(np) :: ind
42 integer*4, dimension(np) :: pos_glo
43 integer*4, dimension(n_glo) :: i_glo
44 integer*4, dimension(n_loc) :: i_loc
45
46 real*8, dimension(n_glo) :: v_glo
47 real*8, dimension(n_loc) :: v_loc
48 real*8, dimension(np) :: val
49
50 ! write(*,*) v_glo
51 ! read(*,*)
52 ! write(*,*) i_glo
53 ! read(*,*)
54
55
56 do i = 1, n_loc
57 do j = 1, np
58
59 pos_glo(j) = n_loc*(j-1) + i
60 ind(j) = i_glo(n_loc*(j-1) + i)
61 val(j) = v_glo(n_loc*(j-1) + i)
62
63 ! write(*,*) j, val(j), ind(j)
64 ! read(*,*)
65 enddo
66
67 pos = minloc(val)
68 ! write(*,*) i, val
69 ! write(*,*) pos(1),pos_glo(pos(1))
70 ! write(*,*) '====================='
71 !i_loc(i) = ind(pos(1))
72 i_loc(i) = pos_glo(pos(1))
73
74 enddo
75
76 end subroutine get_minvalues
subroutine get_minvalues(i_glo, v_glo, n_glo, i_loc, n_loc, np)
Computes positions of minimum values.