46 |
|
if (.not. associated(this_list)) return |
47 |
|
|
48 |
|
temp => this_list |
49 |
< |
|
49 |
> |
|
50 |
|
do while (associated(temp)) |
51 |
|
if (temp%atype_ident == ident) then |
52 |
|
atype => temp |
53 |
|
exit |
54 |
|
endif |
55 |
+ |
|
56 |
|
temp => temp%next |
57 |
|
end do |
58 |
|
|
59 |
|
end subroutine find_atype |
60 |
|
|
61 |
|
subroutine create_identPtrList(ident,this_list,identPtrList,status) |
62 |
+ |
use definitions |
63 |
|
integer, dimension(:) :: ident |
64 |
|
type(generic_atype), pointer :: this_list |
65 |
|
type(generic_atype), pointer :: tmpPtr |
73 |
|
|
74 |
|
status = 0 |
75 |
|
list_size = size(ident) |
76 |
< |
write(*,*) "Creating identPtrList for size: ", list_size |
76 |
> |
|
77 |
|
!! Allocate space for pointer list. |
78 |
|
if (.not. associated(identPtrList)) then |
79 |
|
allocate(identPtrList(list_size),stat=alloc_stat) |
81 |
|
status = -1 |
82 |
|
return |
83 |
|
end if |
84 |
< |
write(*,*) "Successfully allocated new list" |
84 |
> |
|
85 |
|
else if ( list_size > size(identPtrList)) then |
86 |
|
!! We've already allocated this list and need to make it bigger |
87 |
< |
write(*,*) "Warning reallocating identPointerList" |
87 |
> |
|
88 |
|
deallocate(identPtrList) |
89 |
|
allocate(identPtrList(list_size),stat=alloc_stat) |
90 |
|
if (alloc_stat /= 0) then |
101 |
|
|
102 |
|
do i = 1, list_size |
103 |
|
this_ident = ident(i) |
104 |
< |
write(*,*) "Finding atype for ident ", this_ident |
104 |
> |
|
105 |
|
call find_atype(this_ident,this_list,tmpPtr) |
106 |
|
!! If we can't find the atype corresponding to the ident, return w/ error. |
107 |
|
if (.not. associated(tmpPtr)) then |
108 |
|
status = -1 |
107 |
– |
|
109 |
|
write(*,*) "Could not find an atype for ident ", this_ident |
110 |
|
return |
111 |
|
end if |