SICOPOLIS V5-dev  Revision 1368
oad_template_tri_sle.f90
Go to the documentation of this file.
1  subroutine template()
2 
3  use oad_tape
4  use oad_rev
5  use sico_maths_m, only : tri_sle_local
7 !$TEMPLATE_PRAGMA_DECLARATIONS
8 
9  type(modetype) :: our_orig_mode
10  integer iaddr
11  external iaddr
12  integer :: i, nrows_local
13  if (our_rev_mode%plain) then
14  call tri_sle_local(a0%v, a1%v, a2%v, x%v, b%v, nrows)
15  end if
16  if (our_rev_mode%tape) then
17 ! taping
18 ! set up for plain execution
19  our_orig_mode=our_rev_mode
20  our_rev_mode%arg_store=.false.
21  our_rev_mode%arg_restore=.false.
22  our_rev_mode%plain=.true.
23  our_rev_mode%tape=.false.
24  our_rev_mode%adjoint=.false.
25 !!call push_i_s0(nrows)
26  !integer_tape(integer_tape_pointer)=nrows
27  !integer_tape_pointer=integer_tape_pointer+1
28  if (oad_it_sz.lt.oad_it_ptr) call oad_it_grow()
29  oad_it(oad_it_ptr) = nrows
30  oad_it_ptr = oad_it_ptr+1
31  do i=1,nrows
32 !call push_s0(a0(i)%v)
33  !double_tape(double_tape_pointer)=a0(i)%v
34  !double_tape_pointer=double_tape_pointer+1
35  if (oad_dt_sz.lt.oad_dt_ptr) call oad_dt_grow()
36  oad_dt(oad_dt_ptr) = a0(i)%v
37  oad_dt_ptr = oad_dt_ptr+1
38  end do
39  do i=0,nrows
40 !call push_s0(a2(i)%v)
41  !double_tape(double_tape_pointer)=a2(i)%v
42  !double_tape_pointer=double_tape_pointer+1
43  if (oad_dt_sz.lt.oad_dt_ptr) call oad_dt_grow()
44  oad_dt(oad_dt_ptr) = a2(i)%v
45  oad_dt_ptr = oad_dt_ptr+1
46  end do
47  call tri_sle_local(a0%v, a1%v, a2%v, x%v, b%v, nrows)
48  do i=0,nrows
49 !call push_s0(a1(i)%v)
50  !double_tape(double_tape_pointer)=a1(i)%v
51  !double_tape_pointer=double_tape_pointer+1
52  if (oad_dt_sz.lt.oad_dt_ptr) call oad_dt_grow()
53  oad_dt(oad_dt_ptr) = a1(i)%v
54  oad_dt_ptr = oad_dt_ptr+1
55  end do
56  do i=0,nrows
57 !call push_s0(b(i)%v)
58  !double_tape(double_tape_pointer)=b(i)%v
59  !double_tape_pointer=double_tape_pointer+1
60  if (oad_dt_sz.lt.oad_dt_ptr) call oad_dt_grow()
61  oad_dt(oad_dt_ptr) = b(i)%v
62  oad_dt_ptr = oad_dt_ptr+1
63  end do
64  do i=0,nrows
65 !call push_s0(x(i)%v)
66  !double_tape(double_tape_pointer)=x(i)%v
67  !double_tape_pointer=double_tape_pointer+1
68  if (oad_dt_sz.lt.oad_dt_ptr) call oad_dt_grow()
69  oad_dt(oad_dt_ptr) = x(i)%v
70  oad_dt_ptr = oad_dt_ptr+1
71  end do
72  our_rev_mode=our_orig_mode
73  end if
74  if (our_rev_mode%adjoint) then
75 ! adjoint
76  our_orig_mode=our_rev_mode
77  our_rev_mode%arg_store=.false.
78  our_rev_mode%arg_restore=.false.
79  our_rev_mode%plain=.true.
80  our_rev_mode%tape=.false.
81  our_rev_mode%adjoint=.false.
82  !integer_tape_pointer=integer_tape_pointer-1
83  !nrows_local=integer_tape(integer_tape_pointer)
84  oad_it_ptr = oad_it_ptr-1
85  nrows_local = oad_it(oad_it_ptr)
86  do i=nrows_local, 0, -1
87 !call pop_s0(x(i)%v)
88  !double_tape_pointer=double_tape_pointer-1
89  !x(i)%v=double_tape(double_tape_pointer)
90  oad_dt_ptr = oad_dt_ptr-1
91  x(i)%v = oad_dt(oad_dt_ptr)
92  end do
93  do i=nrows_local, 0, -1
94 !call pop_s0(b(i)%v)
95  !double_tape_pointer=double_tape_pointer-1
96  !b(i)%v=double_tape(double_tape_pointer)
97  oad_dt_ptr = oad_dt_ptr-1
98  b(i)%v = oad_dt(oad_dt_ptr)
99  end do
100  do i=nrows_local, 0, -1
101 !call pop_s0(a1(i)%v)
102  !double_tape_pointer=double_tape_pointer-1
103  !a1(i)%v=double_tape(double_tape_pointer)
104  oad_dt_ptr = oad_dt_ptr-1
105  a1(i)%v = oad_dt(oad_dt_ptr)
106  end do
107 
108  do i=nrows_local, 0, -1
109 !call pop_s0(a2(i)%v)
110  !double_tape_pointer=double_tape_pointer-1
111  !a2(i)%v=double_tape(double_tape_pointer)
112  oad_dt_ptr = oad_dt_ptr-1
113  a2(i)%v = oad_dt(oad_dt_ptr)
114  end do
115  do i=nrows_local, 1, -1
116 !call pop_s0(a0(i)%v)
117  !double_tape_pointer=double_tape_pointer-1
118  !a0(i)%v=double_tape(double_tape_pointer)
119  oad_dt_ptr = oad_dt_ptr-1
120  a0(i)%v = oad_dt(oad_dt_ptr)
121  end do
122  call tri_sle_grad(a0%v, a0%d, a1%v, a1%d, a2%v, a2%d, x%v, x%d, b%v, b%d, &
123  &nrows_local)
124  our_rev_mode=our_orig_mode
125  end if
126  end subroutine
Solvers for systems of linear equations used by SICOPOLIS.
Several mathematical tools used by SICOPOLIS.
subroutine template()