-
Notifications
You must be signed in to change notification settings - Fork 0
/
inputter_module.f90
38 lines (32 loc) · 1.19 KB
/
inputter_module.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
module inputter_module
use trinary_module
implicit none
contains
subroutine initialize_inputter(inputter, input_length)
type(trinary), allocatable :: inputter(:)
integer, intent(in) :: input_length
integer :: j
allocate(inputter(input_length))
! Initialize the inputter array with alternating trinary states
do j = 1, input_length
if (mod(j, 3) == 0) then
call inputter(j)%set(low)
elseif (mod(j, 3) == 1) then
call inputter(j)%set(medium)
else
call inputter(j)%set(high)
end if
end do
end subroutine initialize_inputter
subroutine copy_non_low_to_brain_top_row(inputter, brain, input_offset, cols)
type(trinary), allocatable :: inputter(:)
type(trinary), allocatable :: brain(:,:)
integer, intent(in) :: input_offset, cols
integer :: i
do i = 1, size(inputter)
if (inputter(i)%get() /= low) then
call brain(1, input_offset - 1 + i)%set(inputter(i)%get())
end if
end do
end subroutine copy_non_low_to_brain_top_row
end module inputter_module