MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
IndexMap.f90
Go to the documentation of this file.
2 use kindmodule, only: i4b
4 implicit none
5 private
6
7 type, public :: indexmaptype
8 integer(I4B), dimension(:), pointer, contiguous :: src_idx => null()
9 integer(I4B), dimension(:), pointer, contiguous :: tgt_idx => null()
10 contains
11 procedure :: add => add_map
12 procedure :: copy => copy_map
13 procedure, private :: add_map
14 procedure, private :: copy_map
15 end type indexmaptype
16
17 type, public :: indexmapsgntype
18 integer(I4B), dimension(:), pointer, contiguous :: src_idx => null()
19 integer(I4B), dimension(:), pointer, contiguous :: tgt_idx => null()
20 integer(I4B), dimension(:), pointer, contiguous :: sign => null()
21 contains
22 procedure :: add => add_signed_map
23 procedure :: copy => copy_signed_map
24 procedure, private :: add_signed_map
25 procedure, private :: copy_signed_map
26 end type indexmapsgntype
27
28contains
29
30 subroutine add_map(this, map)
31 class(indexmaptype) :: this
32 class(indexmaptype) :: map
33
34 call concatarray(this%src_idx, map%src_idx)
35 call concatarray(this%tgt_idx, map%tgt_idx)
36
37 end subroutine add_map
38
39 subroutine copy_map(this, map)
40 class(indexmaptype) :: this
41 class(indexmaptype) :: map
42 ! local
43 integer(I4B) :: i
44
45 allocate (this%src_idx(size(map%src_idx)))
46 allocate (this%tgt_idx(size(map%tgt_idx)))
47 do i = 1, size(map%src_idx)
48 this%src_idx(i) = map%src_idx(i)
49 end do
50 do i = 1, size(map%tgt_idx)
51 this%tgt_idx(i) = map%tgt_idx(i)
52 end do
53
54 end subroutine copy_map
55
56 subroutine add_signed_map(this, signed_map)
57 class(indexmapsgntype) :: this
58 class(indexmapsgntype) :: signed_map
59
60 call concatarray(this%src_idx, signed_map%src_idx)
61 call concatarray(this%tgt_idx, signed_map%tgt_idx)
62 call concatarray(this%sign, signed_map%sign)
63
64 end subroutine add_signed_map
65
66 subroutine copy_signed_map(this, signed_map)
67 class(indexmapsgntype) :: this
68 class(indexmapsgntype) :: signed_map
69 ! local
70 integer(I4B) :: i
71
72 allocate (this%src_idx(size(signed_map%src_idx)))
73 allocate (this%tgt_idx(size(signed_map%tgt_idx)))
74 allocate (this%sign(size(signed_map%sign)))
75 do i = 1, size(signed_map%src_idx)
76 this%src_idx(i) = signed_map%src_idx(i)
77 end do
78 do i = 1, size(signed_map%tgt_idx)
79 this%tgt_idx(i) = signed_map%tgt_idx(i)
80 end do
81 do i = 1, size(signed_map%sign)
82 this%sign(i) = signed_map%sign(i)
83 end do
84
85 end subroutine copy_signed_map
86end module indexmapmodule
subroutine add_signed_map(this, signed_map)
Definition IndexMap.f90:57
subroutine copy_map(this, map)
Definition IndexMap.f90:40
subroutine add_map(this, map)
Definition IndexMap.f90:31
subroutine copy_signed_map(this, signed_map)
Definition IndexMap.f90:67
This module defines variable data types.
Definition kind.f90:8