1 module module_linked_list2
4 character(len=256) :: name ! name
5 real, pointer :: value(:) ! data
6 type(linked_list), pointer :: next ! pointer to the next element
9 type(linked_list), pointer :: linklist_head, linklist_tail
12 MODULE PROCEDURE push_1_array, push_2_arrays, push_3_arrays, push_4_arrays, push_5_arrays, &
13 push_6_arrays, push_7_arrays, push_8_arrays, push_9_arrays, push_10_arrays, &
14 push_2d_1_array, push_2d_2_arrays, push_2d_3_arrays, push_2d_4_arrays, push_2d_5_arrays, &
15 push_2d_6_arrays, push_2d_7_arrays, push_2d_8_arrays, push_2d_9_arrays, push_2d_10_arrays, &
16 push_3d_1_array, push_3d_2_arrays, push_3d_3_arrays, push_3d_4_arrays, push_3d_5_arrays, &
17 push_3d_6_arrays, push_3d_7_arrays, push_3d_8_arrays, push_3d_9_arrays, push_3d_10_arrays, &
18 push_4d_1_array, push_4d_2_arrays, push_4d_3_arrays, push_4d_4_arrays, push_4d_5_arrays, &
19 push_4d_6_arrays, push_4d_7_arrays, push_4d_8_arrays, push_4d_9_arrays, push_4d_10_arrays
23 MODULE PROCEDURE pop_1_array, pop_2_arrays, pop_3_arrays, pop_4_arrays, pop_5_arrays, &
24 pop_6_arrays, pop_7_arrays, pop_8_arrays, pop_9_arrays, pop_10_arrays, &
25 pop_2d_1_array, pop_2d_2_arrays, pop_2d_3_arrays, pop_2d_4_arrays, pop_2d_5_arrays, &
26 pop_2d_6_arrays, pop_2d_7_arrays, pop_2d_8_arrays, pop_2d_9_arrays, pop_2d_10_arrays, &
27 pop_3d_1_array, pop_3d_2_arrays, pop_3d_3_arrays, pop_3d_4_arrays, pop_3d_5_arrays, &
28 pop_3d_6_arrays, pop_3d_7_arrays, pop_3d_8_arrays, pop_3d_9_arrays, pop_3d_10_arrays, &
29 pop_4d_1_array, pop_4d_2_arrays, pop_4d_3_arrays, pop_4d_4_arrays, pop_4d_5_arrays, &
30 pop_4d_6_arrays, pop_4d_7_arrays, pop_4d_8_arrays, pop_4d_9_arrays, pop_4d_10_arrays
33 INTERFACE backup_array
34 MODULE PROCEDURE backup_1d_array, backup_2d_array, backup_3d_array, backup_4d_array
37 INTERFACE restore_array
38 MODULE PROCEDURE restore_1d_array, restore_2d_array, restore_3d_array, restore_4d_array
43 subroutine linkedlist_initialize
47 type(linked_list), pointer :: current
49 current => linklist_head
50 do while (associated(current))
51 linklist_head => current%next
52 deallocate(current%value)
54 current => linklist_head
57 nullify(linklist_head)
59 print *, "linkedlist_initialized."
61 end subroutine linkedlist_initialize
63 subroutine check_linkedlist
67 type(linked_list), pointer :: current
69 current => linklist_head
70 do while (associated(current))
71 write(unit=6, fmt='(a,i4,3a)') 'check id:', current%id, ', name: <', trim(current%name), '>'
72 current => current%next
75 end subroutine check_linkedlist
77 subroutine push_1_array(a1, varname)
81 real, dimension(:), intent(in) :: a1
82 character(len=*), intent(in) :: varname
86 type(linked_list), pointer :: current
90 if(.not. associated(linklist_head)) then
91 nullify(linklist_head)
93 allocate(linklist_head)
94 allocate(linklist_head%value(length))
95 nullify(linklist_head%next)
98 linklist_head%name = varname
99 linklist_head%value(:) = a1(:)
101 linklist_tail => linklist_head
104 allocate(current%value(length))
105 nullify(current%next)
106 current%id = linklist_head%id + 1
107 current%name = varname
108 current%value(:) = a1(:)
109 current%next => linklist_head
110 linklist_head => current
113 ! write(unit=*, fmt='(a,i4,3a)') &
114 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
116 end subroutine push_1_array
118 subroutine pop_1_array(a1, varname)
122 real, dimension(:), intent(out) :: a1
123 character(len=*), intent(in) :: varname
127 type(linked_list), pointer :: current
131 current => linklist_head
133 if(trim(current%name) /= trim(varname)) then
134 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
135 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
139 ! write(unit=*, fmt='(a,i4,3a)') &
140 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
142 a1(1:length) = current%value(1:length)
144 current => current%next
146 nullify(linklist_head%next)
147 deallocate(linklist_head%value)
148 deallocate(linklist_head)
149 linklist_head => current
151 end subroutine pop_1_array
153 subroutine push_2_arrays(a1, a2, varname)
157 real, dimension(:), intent(in) :: a1, a2
158 character(len=*), intent(in) :: varname
160 type(linked_list), pointer :: current
163 integer, dimension(2) :: len
164 integer, dimension(0:2) :: num
171 num(n) = num(n-1) + len(n)
174 if(.not. associated(linklist_head)) then
175 nullify(linklist_head)
177 allocate(linklist_head)
178 allocate(linklist_head%value(num(2)))
179 nullify(linklist_head%next)
182 linklist_head%name = varname
183 linklist_head%value(num(0)+1:num(1)) = a1(1:len(1))
184 linklist_head%value(num(1)+1:num(2)) = a2(1:len(2))
186 linklist_tail => linklist_head
189 allocate(current%value(num(2)))
190 nullify(current%next)
191 current%id = linklist_head%id + 1
192 current%name = varname
193 current%value(num(0)+1:num(1)) = a1(1:len(1))
194 current%value(num(1)+1:num(2)) = a2(1:len(2))
195 current%next => linklist_head
196 linklist_head => current
199 ! write(unit=*, fmt='(a,i4,3a)') &
200 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
202 end subroutine push_2_arrays
204 subroutine pop_2_arrays(a1, a2, varname)
208 real, dimension(:), intent(out) :: a1, a2
209 character(len=*), intent(in) :: varname
211 type(linked_list), pointer :: current
214 integer, dimension(2) :: len
215 integer, dimension(0:2) :: num
222 num(n) = num(n-1) + len(n)
225 current => linklist_head
227 if(trim(current%name) /= trim(varname)) then
228 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
229 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
233 ! write(unit=*, fmt='(a,i4,3a)') &
234 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
236 a1(1:len(1)) = current%value(num(0)+1:num(1))
237 a2(1:len(2)) = current%value(num(1)+1:num(2))
239 current => current%next
241 nullify(linklist_head%next)
242 deallocate(linklist_head%value)
243 deallocate(linklist_head)
244 linklist_head => current
246 end subroutine pop_2_arrays
248 subroutine push_3_arrays(a1, a2, a3, varname)
252 real, dimension(:), intent(in) :: a1, a2, a3
253 character(len=*), intent(in) :: varname
255 type(linked_list), pointer :: current
258 integer, dimension(3) :: len
259 integer, dimension(0:3) :: num
267 num(n) = num(n-1) + len(n)
270 if(.not. associated(linklist_head)) then
271 nullify(linklist_head)
273 allocate(linklist_head)
274 allocate(linklist_head%value(num(3)))
275 nullify(linklist_head%next)
278 linklist_head%name = varname
279 linklist_head%value(num(0)+1:num(1)) = a1(1:len(1))
280 linklist_head%value(num(1)+1:num(2)) = a2(1:len(2))
281 linklist_head%value(num(2)+1:num(3)) = a3(1:len(3))
283 linklist_tail => linklist_head
286 allocate(current%value(num(3)))
287 nullify(current%next)
288 current%id = linklist_head%id + 1
289 current%name = varname
290 current%value(num(0)+1:num(1)) = a1(1:len(1))
291 current%value(num(1)+1:num(2)) = a2(1:len(2))
292 current%value(num(2)+1:num(3)) = a3(1:len(3))
293 current%next => linklist_head
294 linklist_head => current
297 ! write(unit=*, fmt='(a,i4,3a)') &
298 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
300 end subroutine push_3_arrays
302 subroutine pop_3_arrays(a1, a2, a3, varname)
306 real, dimension(:), intent(out) :: a1, a2, a3
307 character(len=*), intent(in) :: varname
309 type(linked_list), pointer :: current
312 integer, dimension(3) :: len
313 integer, dimension(0:3) :: num
321 num(n) = num(n-1) + len(n)
324 current => linklist_head
326 if(trim(current%name) /= trim(varname)) then
327 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
328 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
332 ! write(unit=*, fmt='(a,i4,3a)') &
333 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
335 a1(1:len(1)) = current%value(num(0)+1:num(1))
336 a2(1:len(2)) = current%value(num(1)+1:num(2))
337 a3(1:len(3)) = current%value(num(2)+1:num(3))
339 current => current%next
341 nullify(linklist_head%next)
342 deallocate(linklist_head%value)
343 deallocate(linklist_head)
344 linklist_head => current
346 end subroutine pop_3_arrays
348 subroutine push_4_arrays(a1, a2, a3, a4, varname)
352 real, dimension(:), intent(in) :: a1, a2, a3, a4
353 character(len=*), intent(in) :: varname
355 type(linked_list), pointer :: current
358 integer, dimension(4) :: len
359 integer, dimension(0:4) :: num
368 num(n) = num(n-1) + len(n)
371 if(.not. associated(linklist_head)) then
372 nullify(linklist_head)
374 allocate(linklist_head)
375 allocate(linklist_head%value(num(4)))
376 nullify(linklist_head%next)
379 linklist_head%name = varname
380 linklist_head%value(num(0)+1:num(1)) = a1(1:len(1))
381 linklist_head%value(num(1)+1:num(2)) = a2(1:len(2))
382 linklist_head%value(num(2)+1:num(3)) = a3(1:len(3))
383 linklist_head%value(num(3)+1:num(4)) = a4(1:len(4))
385 linklist_tail => linklist_head
388 allocate(current%value(num(4)))
389 nullify(current%next)
390 current%id = linklist_head%id + 1
391 current%name = varname
392 current%value(num(0)+1:num(1)) = a1(1:len(1))
393 current%value(num(1)+1:num(2)) = a2(1:len(2))
394 current%value(num(2)+1:num(3)) = a3(1:len(3))
395 current%value(num(3)+1:num(4)) = a4(1:len(4))
396 current%next => linklist_head
397 linklist_head => current
400 ! write(unit=*, fmt='(a,i4,3a)') &
401 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
403 end subroutine push_4_arrays
405 subroutine pop_4_arrays(a1, a2, a3, a4, varname)
409 real, dimension(:), intent(out) :: a1, a2, a3, a4
410 character(len=*), intent(in) :: varname
412 type(linked_list), pointer :: current
415 integer, dimension(4) :: len
416 integer, dimension(0:4) :: num
425 num(n) = num(n-1) + len(n)
428 current => linklist_head
430 if(trim(current%name) /= trim(varname)) then
431 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
432 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
436 ! write(unit=*, fmt='(a,i4,3a)') &
437 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
439 a1(1:len(1)) = current%value(num(0)+1:num(1))
440 a2(1:len(2)) = current%value(num(1)+1:num(2))
441 a3(1:len(3)) = current%value(num(2)+1:num(3))
442 a4(1:len(4)) = current%value(num(3)+1:num(4))
444 current => current%next
446 nullify(linklist_head%next)
447 deallocate(linklist_head%value)
448 deallocate(linklist_head)
449 linklist_head => current
451 end subroutine pop_4_arrays
453 subroutine push_5_arrays(a1, a2, a3, a4, a5, varname)
457 real, dimension(:), intent(in) :: a1, a2, a3, a4, a5
458 character(len=*), intent(in) :: varname
460 type(linked_list), pointer :: current
463 integer, dimension(5) :: len
464 integer, dimension(0:5) :: num
474 num(n) = num(n-1) + len(n)
477 if(.not. associated(linklist_head)) then
478 nullify(linklist_head)
480 allocate(linklist_head)
481 allocate(linklist_head%value(num(5)))
482 nullify(linklist_head%next)
485 linklist_head%name = varname
486 linklist_head%value(num(0)+1:num(1)) = a1(1:len(1))
487 linklist_head%value(num(1)+1:num(2)) = a2(1:len(2))
488 linklist_head%value(num(2)+1:num(3)) = a3(1:len(3))
489 linklist_head%value(num(3)+1:num(4)) = a4(1:len(4))
490 linklist_head%value(num(4)+1:num(5)) = a5(1:len(5))
492 linklist_tail => linklist_head
495 allocate(current%value(num(5)))
496 nullify(current%next)
497 current%id = linklist_head%id + 1
498 current%name = varname
499 current%value(num(0)+1:num(1)) = a1(1:len(1))
500 current%value(num(1)+1:num(2)) = a2(1:len(2))
501 current%value(num(2)+1:num(3)) = a3(1:len(3))
502 current%value(num(3)+1:num(4)) = a4(1:len(4))
503 current%value(num(4)+1:num(5)) = a5(1:len(5))
504 current%next => linklist_head
505 linklist_head => current
508 ! write(unit=*, fmt='(a,i4,3a)') &
509 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
511 end subroutine push_5_arrays
513 subroutine pop_5_arrays(a1, a2, a3, a4, a5, varname)
517 real, dimension(:), intent(out) :: a1, a2, a3, a4, a5
518 character(len=*), intent(in) :: varname
520 type(linked_list), pointer :: current
523 integer, dimension(5) :: len
524 integer, dimension(0:5) :: num
534 num(n) = num(n-1) + len(n)
537 current => linklist_head
539 if(trim(current%name) /= trim(varname)) then
540 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
541 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
545 ! write(unit=*, fmt='(a,i4,3a)') &
546 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
548 a1(1:len(1)) = current%value(num(0)+1:num(1))
549 a2(1:len(2)) = current%value(num(1)+1:num(2))
550 a3(1:len(3)) = current%value(num(2)+1:num(3))
551 a4(1:len(4)) = current%value(num(3)+1:num(4))
552 a5(1:len(5)) = current%value(num(4)+1:num(5))
554 current => current%next
556 nullify(linklist_head%next)
557 deallocate(linklist_head%value)
558 deallocate(linklist_head)
559 linklist_head => current
561 end subroutine pop_5_arrays
563 subroutine push_6_arrays(a1, a2, a3, a4, a5, a6, varname)
567 real, dimension(:), intent(in) :: a1, a2, a3, a4, a5, a6
568 character(len=*), intent(in) :: varname
570 type(linked_list), pointer :: current
573 integer, dimension(6) :: len
574 integer, dimension(0:6) :: num
585 num(n) = num(n-1) + len(n)
588 if(.not. associated(linklist_head)) then
589 nullify(linklist_head)
591 allocate(linklist_head)
592 allocate(linklist_head%value(num(6)))
593 nullify(linklist_head%next)
596 linklist_head%name = varname
597 linklist_head%value(num(0)+1:num(1)) = a1(1:len(1))
598 linklist_head%value(num(1)+1:num(2)) = a2(1:len(2))
599 linklist_head%value(num(2)+1:num(3)) = a3(1:len(3))
600 linklist_head%value(num(3)+1:num(4)) = a4(1:len(4))
601 linklist_head%value(num(4)+1:num(5)) = a5(1:len(5))
602 linklist_head%value(num(5)+1:num(6)) = a6(1:len(6))
604 linklist_tail => linklist_head
607 allocate(current%value(num(6)))
608 nullify(current%next)
609 current%id = linklist_head%id + 1
610 current%name = varname
611 current%value(num(0)+1:num(1)) = a1(1:len(1))
612 current%value(num(1)+1:num(2)) = a2(1:len(2))
613 current%value(num(2)+1:num(3)) = a3(1:len(3))
614 current%value(num(3)+1:num(4)) = a4(1:len(4))
615 current%value(num(4)+1:num(5)) = a5(1:len(5))
616 current%value(num(5)+1:num(6)) = a6(1:len(6))
617 current%next => linklist_head
618 linklist_head => current
621 ! write(unit=*, fmt='(a,i4,3a)') &
622 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
624 end subroutine push_6_arrays
626 subroutine pop_6_arrays(a1, a2, a3, a4, a5, a6, varname)
630 real, dimension(:), intent(out) :: a1, a2, a3, a4, a5, a6
631 character(len=*), intent(in) :: varname
633 type(linked_list), pointer :: current
636 integer, dimension(6) :: len
637 integer, dimension(0:6) :: num
648 num(n) = num(n-1) + len(n)
651 current => linklist_head
653 if(trim(current%name) /= trim(varname)) then
654 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
655 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
659 ! write(unit=*, fmt='(a,i4,3a)') &
660 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
662 a1(1:len(1)) = current%value(num(0)+1:num(1))
663 a2(1:len(2)) = current%value(num(1)+1:num(2))
664 a3(1:len(3)) = current%value(num(2)+1:num(3))
665 a4(1:len(4)) = current%value(num(3)+1:num(4))
666 a5(1:len(5)) = current%value(num(4)+1:num(5))
667 a6(1:len(6)) = current%value(num(5)+1:num(6))
669 current => current%next
671 nullify(linklist_head%next)
672 deallocate(linklist_head%value)
673 deallocate(linklist_head)
674 linklist_head => current
676 end subroutine pop_6_arrays
678 subroutine push_7_arrays(a1, a2, a3, a4, a5, a6, a7, varname)
682 real, dimension(:), intent(in) :: a1, a2, a3, a4, a5, a6, a7
683 character(len=*), intent(in) :: varname
685 type(linked_list), pointer :: current
688 integer, dimension(7) :: len
689 integer, dimension(0:7) :: num
701 num(n) = num(n-1) + len(n)
704 if(.not. associated(linklist_head)) then
705 nullify(linklist_head)
707 allocate(linklist_head)
708 allocate(linklist_head%value(num(7)))
709 nullify(linklist_head%next)
712 linklist_head%name = varname
713 linklist_head%value(num(0)+1:num(1)) = a1(1:len(1))
714 linklist_head%value(num(1)+1:num(2)) = a2(1:len(2))
715 linklist_head%value(num(2)+1:num(3)) = a3(1:len(3))
716 linklist_head%value(num(3)+1:num(4)) = a4(1:len(4))
717 linklist_head%value(num(4)+1:num(5)) = a5(1:len(5))
718 linklist_head%value(num(5)+1:num(6)) = a6(1:len(6))
719 linklist_head%value(num(6)+1:num(7)) = a7(1:len(7))
721 linklist_tail => linklist_head
724 allocate(current%value(num(7)))
725 nullify(current%next)
726 current%id = linklist_head%id + 1
727 current%name = varname
728 current%value(num(0)+1:num(1)) = a1(1:len(1))
729 current%value(num(1)+1:num(2)) = a2(1:len(2))
730 current%value(num(2)+1:num(3)) = a3(1:len(3))
731 current%value(num(3)+1:num(4)) = a4(1:len(4))
732 current%value(num(4)+1:num(5)) = a5(1:len(5))
733 current%value(num(5)+1:num(6)) = a6(1:len(6))
734 current%value(num(6)+1:num(7)) = a7(1:len(7))
735 current%next => linklist_head
736 linklist_head => current
739 ! write(unit=*, fmt='(a,i4,3a)') &
740 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
742 end subroutine push_7_arrays
744 subroutine pop_7_arrays(a1, a2, a3, a4, a5, a6, a7, varname)
748 real, dimension(:), intent(out) :: a1, a2, a3, a4, a5, a6, a7
749 character(len=*), intent(in) :: varname
751 type(linked_list), pointer :: current
754 integer, dimension(7) :: len
755 integer, dimension(0:7) :: num
767 num(n) = num(n-1) + len(n)
770 current => linklist_head
772 if(trim(current%name) /= trim(varname)) then
773 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
774 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
778 ! write(unit=*, fmt='(a,i4,3a)') &
779 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
781 a1(1:len(1)) = current%value(num(0)+1:num(1))
782 a2(1:len(2)) = current%value(num(1)+1:num(2))
783 a3(1:len(3)) = current%value(num(2)+1:num(3))
784 a4(1:len(4)) = current%value(num(3)+1:num(4))
785 a5(1:len(5)) = current%value(num(4)+1:num(5))
786 a6(1:len(6)) = current%value(num(5)+1:num(6))
787 a7(1:len(7)) = current%value(num(6)+1:num(7))
789 current => current%next
791 nullify(linklist_head%next)
792 deallocate(linklist_head%value)
793 deallocate(linklist_head)
794 linklist_head => current
796 end subroutine pop_7_arrays
798 subroutine push_8_arrays(a1, a2, a3, a4, a5, a6, a7, a8, varname)
802 real, dimension(:), intent(in) :: a1, a2, a3, a4, a5, a6, a7, a8
803 character(len=*), intent(in) :: varname
805 type(linked_list), pointer :: current
808 integer, dimension(8) :: len
809 integer, dimension(0:8) :: num
822 num(n) = num(n-1) + len(n)
825 if(.not. associated(linklist_head)) then
826 nullify(linklist_head)
828 allocate(linklist_head)
829 allocate(linklist_head%value(num(8)))
830 nullify(linklist_head%next)
833 linklist_head%name = varname
834 linklist_head%value(num(0)+1:num(1)) = a1(1:len(1))
835 linklist_head%value(num(1)+1:num(2)) = a2(1:len(2))
836 linklist_head%value(num(2)+1:num(3)) = a3(1:len(3))
837 linklist_head%value(num(3)+1:num(4)) = a4(1:len(4))
838 linklist_head%value(num(4)+1:num(5)) = a5(1:len(5))
839 linklist_head%value(num(5)+1:num(6)) = a6(1:len(6))
840 linklist_head%value(num(6)+1:num(7)) = a7(1:len(7))
841 linklist_head%value(num(7)+1:num(8)) = a8(1:len(8))
843 linklist_tail => linklist_head
846 allocate(current%value(num(8)))
847 nullify(current%next)
848 current%id = linklist_head%id + 1
849 current%name = varname
850 current%value(num(0)+1:num(1)) = a1(1:len(1))
851 current%value(num(1)+1:num(2)) = a2(1:len(2))
852 current%value(num(2)+1:num(3)) = a3(1:len(3))
853 current%value(num(3)+1:num(4)) = a4(1:len(4))
854 current%value(num(4)+1:num(5)) = a5(1:len(5))
855 current%value(num(5)+1:num(6)) = a6(1:len(6))
856 current%value(num(6)+1:num(7)) = a7(1:len(7))
857 current%value(num(7)+1:num(8)) = a8(1:len(8))
858 current%next => linklist_head
859 linklist_head => current
862 ! write(unit=*, fmt='(a,i4,3a)') &
863 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
865 end subroutine push_8_arrays
867 subroutine pop_8_arrays(a1, a2, a3, a4, a5, a6, a7, a8, varname)
871 real, dimension(:), intent(out) :: a1, a2, a3, a4, a5, a6, a7, a8
872 character(len=*), intent(in) :: varname
874 type(linked_list), pointer :: current
877 integer, dimension(8) :: len
878 integer, dimension(0:8) :: num
891 num(n) = num(n-1) + len(n)
894 current => linklist_head
896 if(trim(current%name) /= trim(varname)) then
897 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
898 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
902 ! write(unit=*, fmt='(a,i4,3a)') &
903 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
905 a1(1:len(1)) = current%value(num(0)+1:num(1))
906 a2(1:len(2)) = current%value(num(1)+1:num(2))
907 a3(1:len(3)) = current%value(num(2)+1:num(3))
908 a4(1:len(4)) = current%value(num(3)+1:num(4))
909 a5(1:len(5)) = current%value(num(4)+1:num(5))
910 a6(1:len(6)) = current%value(num(5)+1:num(6))
911 a7(1:len(7)) = current%value(num(6)+1:num(7))
912 a8(1:len(8)) = current%value(num(7)+1:num(8))
914 current => current%next
916 nullify(linklist_head%next)
917 deallocate(linklist_head%value)
918 deallocate(linklist_head)
919 linklist_head => current
921 end subroutine pop_8_arrays
923 subroutine push_9_arrays(a1, a2, a3, a4, a5, a6, a7, a8, a9, varname)
927 real, dimension(:), intent(in) :: a1, a2, a3, a4, a5, a6, a7, a8, a9
928 character(len=*), intent(in) :: varname
930 type(linked_list), pointer :: current
933 integer, dimension(9) :: len
934 integer, dimension(0:9) :: num
948 num(n) = num(n-1) + len(n)
951 if(.not. associated(linklist_head)) then
952 nullify(linklist_head)
954 allocate(linklist_head)
955 allocate(linklist_head%value(num(9)))
956 nullify(linklist_head%next)
959 linklist_head%name = varname
960 linklist_head%value(num(0)+1:num(1)) = a1(1:len(1))
961 linklist_head%value(num(1)+1:num(2)) = a2(1:len(2))
962 linklist_head%value(num(2)+1:num(3)) = a3(1:len(3))
963 linklist_head%value(num(3)+1:num(4)) = a4(1:len(4))
964 linklist_head%value(num(4)+1:num(5)) = a5(1:len(5))
965 linklist_head%value(num(5)+1:num(6)) = a6(1:len(6))
966 linklist_head%value(num(6)+1:num(7)) = a7(1:len(7))
967 linklist_head%value(num(7)+1:num(8)) = a8(1:len(8))
968 linklist_head%value(num(8)+1:num(9)) = a9(1:len(9))
970 linklist_tail => linklist_head
973 allocate(current%value(num(9)))
974 nullify(current%next)
975 current%id = linklist_head%id + 1
976 current%name = varname
977 current%value(num(0)+1:num(1)) = a1(1:len(1))
978 current%value(num(1)+1:num(2)) = a2(1:len(2))
979 current%value(num(2)+1:num(3)) = a3(1:len(3))
980 current%value(num(3)+1:num(4)) = a4(1:len(4))
981 current%value(num(4)+1:num(5)) = a5(1:len(5))
982 current%value(num(5)+1:num(6)) = a6(1:len(6))
983 current%value(num(6)+1:num(7)) = a7(1:len(7))
984 current%value(num(7)+1:num(8)) = a8(1:len(8))
985 current%value(num(8)+1:num(9)) = a9(1:len(9))
986 current%next => linklist_head
987 linklist_head => current
990 ! write(unit=*, fmt='(a,i4,3a)') &
991 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
993 end subroutine push_9_arrays
995 subroutine pop_9_arrays(a1, a2, a3, a4, a5, a6, a7, a8, a9, varname)
999 real, dimension(:), intent(out) :: a1, a2, a3, a4, a5, a6, a7, a8, a9
1000 character(len=*), intent(in) :: varname
1002 type(linked_list), pointer :: current
1005 integer, dimension(9) :: len
1006 integer, dimension(0:9) :: num
1020 num(n) = num(n-1) + len(n)
1023 current => linklist_head
1025 if(trim(current%name) /= trim(varname)) then
1026 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
1027 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
1031 ! write(unit=*, fmt='(a,i4,3a)') &
1032 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
1034 a1(1:len(1)) = current%value(num(0)+1:num(1))
1035 a2(1:len(2)) = current%value(num(1)+1:num(2))
1036 a3(1:len(3)) = current%value(num(2)+1:num(3))
1037 a4(1:len(4)) = current%value(num(3)+1:num(4))
1038 a5(1:len(5)) = current%value(num(4)+1:num(5))
1039 a6(1:len(6)) = current%value(num(5)+1:num(6))
1040 a7(1:len(7)) = current%value(num(6)+1:num(7))
1041 a8(1:len(8)) = current%value(num(7)+1:num(8))
1042 a9(1:len(9)) = current%value(num(8)+1:num(9))
1044 current => current%next
1046 nullify(linklist_head%next)
1047 deallocate(linklist_head%value)
1048 deallocate(linklist_head)
1049 linklist_head => current
1051 end subroutine pop_9_arrays
1053 subroutine push_10_arrays(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, varname)
1057 real, dimension(:), intent(in) :: a1, a2, a3, a4, a5, a6, a7, a8, a9, a10
1058 character(len=*), intent(in) :: varname
1060 type(linked_list), pointer :: current
1063 integer, dimension(10) :: len
1064 integer, dimension(0:10) :: num
1079 num(n) = num(n-1) + len(n)
1082 if(.not. associated(linklist_head)) then
1083 nullify(linklist_head)
1085 allocate(linklist_head)
1086 allocate(linklist_head%value(num(10)))
1087 nullify(linklist_head%next)
1089 linklist_head%id = 1
1090 linklist_head%name = varname
1091 linklist_head%value(num(0)+1:num(1)) = a1(1:len(1))
1092 linklist_head%value(num(1)+1:num(2)) = a2(1:len(2))
1093 linklist_head%value(num(2)+1:num(3)) = a3(1:len(3))
1094 linklist_head%value(num(3)+1:num(4)) = a4(1:len(4))
1095 linklist_head%value(num(4)+1:num(5)) = a5(1:len(5))
1096 linklist_head%value(num(5)+1:num(6)) = a6(1:len(6))
1097 linklist_head%value(num(6)+1:num(7)) = a7(1:len(7))
1098 linklist_head%value(num(7)+1:num(8)) = a8(1:len(8))
1099 linklist_head%value(num(8)+1:num(9)) = a9(1:len(9))
1100 linklist_head%value(num(9)+1:num(10)) = a10(1:len(10))
1102 linklist_tail => linklist_head
1105 allocate(current%value(num(10)))
1106 nullify(current%next)
1107 current%id = linklist_head%id + 1
1108 current%name = varname
1109 current%value(num(0)+1:num(1)) = a1(1:len(1))
1110 current%value(num(1)+1:num(2)) = a2(1:len(2))
1111 current%value(num(2)+1:num(3)) = a3(1:len(3))
1112 current%value(num(3)+1:num(4)) = a4(1:len(4))
1113 current%value(num(4)+1:num(5)) = a5(1:len(5))
1114 current%value(num(5)+1:num(6)) = a6(1:len(6))
1115 current%value(num(6)+1:num(7)) = a7(1:len(7))
1116 current%value(num(7)+1:num(8)) = a8(1:len(8))
1117 current%value(num(8)+1:num(9)) = a9(1:len(9))
1118 current%value(num(9)+1:num(10)) = a10(1:len(10))
1119 current%next => linklist_head
1120 linklist_head => current
1123 ! write(unit=*, fmt='(a,i4,3a)') &
1124 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
1126 end subroutine push_10_arrays
1128 subroutine pop_10_arrays(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, varname)
1132 real, dimension(:), intent(out) :: a1, a2, a3, a4, a5, a6, a7, a8, a9, a10
1133 character(len=*), intent(in) :: varname
1135 type(linked_list), pointer :: current
1138 integer, dimension(10) :: len
1139 integer, dimension(0:10) :: num
1154 num(n) = num(n-1) + len(n)
1157 current => linklist_head
1159 if(trim(current%name) /= trim(varname)) then
1160 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
1161 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
1165 ! write(unit=*, fmt='(a,i4,3a)') &
1166 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
1168 a1(1:len(1)) = current%value(num(0)+1:num(1))
1169 a2(1:len(2)) = current%value(num(1)+1:num(2))
1170 a3(1:len(3)) = current%value(num(2)+1:num(3))
1171 a4(1:len(4)) = current%value(num(3)+1:num(4))
1172 a5(1:len(5)) = current%value(num(4)+1:num(5))
1173 a6(1:len(6)) = current%value(num(5)+1:num(6))
1174 a7(1:len(7)) = current%value(num(6)+1:num(7))
1175 a8(1:len(8)) = current%value(num(7)+1:num(8))
1176 a9(1:len(9)) = current%value(num(8)+1:num(9))
1177 a10(1:len(10)) = current%value(num(9)+1:num(10))
1179 current => current%next
1181 nullify(linklist_head%next)
1182 deallocate(linklist_head%value)
1183 deallocate(linklist_head)
1184 linklist_head => current
1186 end subroutine pop_10_arrays
1188 subroutine push_2d_1_array(a1, varname)
1192 real, dimension(:,:), intent(in) :: a1
1193 character(len=*), intent(in) :: varname
1197 type(linked_list), pointer :: current
1201 if(.not. associated(linklist_head)) then
1202 nullify(linklist_head)
1204 allocate(linklist_head)
1205 allocate(linklist_head%value(length))
1206 nullify(linklist_head%next)
1208 linklist_head%id = 1
1209 linklist_head%name = varname
1210 call backup_array(linklist_head%value, a1, length)
1212 linklist_tail => linklist_head
1215 allocate(current%value(length))
1216 nullify(current%next)
1217 current%id = linklist_head%id + 1
1218 current%name = varname
1219 call backup_array(current%value, a1, length)
1220 current%next => linklist_head
1221 linklist_head => current
1224 ! write(unit=*, fmt='(a,i4,3a)') &
1225 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
1227 end subroutine push_2d_1_array
1229 subroutine pop_2d_1_array(a1, varname)
1233 real, dimension(:,:), intent(out) :: a1
1234 character(len=*), intent(in) :: varname
1238 type(linked_list), pointer :: current
1242 current => linklist_head
1244 if(trim(current%name) /= trim(varname)) then
1245 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
1246 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
1250 ! write(unit=*, fmt='(a,i4,3a)') &
1251 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
1253 call restore_array(a1, current%value, length)
1255 current => current%next
1257 nullify(linklist_head%next)
1258 deallocate(linklist_head%value)
1259 deallocate(linklist_head)
1260 linklist_head => current
1262 end subroutine pop_2d_1_array
1264 subroutine push_2d_2_arrays(a1, a2, varname)
1268 real, dimension(:,:), intent(in) :: a1, a2
1269 character(len=*), intent(in) :: varname
1271 type(linked_list), pointer :: current
1274 integer, dimension(2) :: len
1275 integer, dimension(0:2) :: num
1282 num(n) = num(n-1) + len(n)
1285 if(.not. associated(linklist_head)) then
1286 nullify(linklist_head)
1288 allocate(linklist_head)
1289 allocate(linklist_head%value(num(2)))
1290 nullify(linklist_head%next)
1292 linklist_head%id = 1
1293 linklist_head%name = varname
1294 call backup_array(linklist_head%value(num(0)+1:num(1)), a1, len(1))
1295 call backup_array(linklist_head%value(num(1)+1:num(2)), a2, len(2))
1297 linklist_tail => linklist_head
1300 allocate(current%value(num(2)))
1301 nullify(current%next)
1302 current%id = linklist_head%id + 1
1303 current%name = varname
1304 call backup_array(current%value(num(0)+1:num(1)), a1, len(1))
1305 call backup_array(current%value(num(1)+1:num(2)), a2, len(2))
1306 current%next => linklist_head
1307 linklist_head => current
1310 ! write(unit=*, fmt='(a,i4,3a)') &
1311 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
1313 end subroutine push_2d_2_arrays
1315 subroutine pop_2d_2_arrays(a1, a2, varname)
1319 real, dimension(:,:), intent(out) :: a1, a2
1320 character(len=*), intent(in) :: varname
1322 type(linked_list), pointer :: current
1325 integer, dimension(2) :: len
1326 integer, dimension(0:2) :: num
1333 num(n) = num(n-1) + len(n)
1336 current => linklist_head
1338 if(trim(current%name) /= trim(varname)) then
1339 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
1340 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
1344 ! write(unit=*, fmt='(a,i4,3a)') &
1345 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
1347 call restore_array(a1, current%value(num(0)+1:num(1)), len(1))
1348 call restore_array(a2, current%value(num(1)+1:num(2)), len(2))
1350 current => current%next
1352 nullify(linklist_head%next)
1353 deallocate(linklist_head%value)
1354 deallocate(linklist_head)
1355 linklist_head => current
1357 end subroutine pop_2d_2_arrays
1359 subroutine push_2d_3_arrays(a1, a2, a3, varname)
1363 real, dimension(:,:), intent(in) :: a1, a2, a3
1364 character(len=*), intent(in) :: varname
1366 type(linked_list), pointer :: current
1369 integer, dimension(3) :: len
1370 integer, dimension(0:3) :: num
1378 num(n) = num(n-1) + len(n)
1381 if(.not. associated(linklist_head)) then
1382 nullify(linklist_head)
1384 allocate(linklist_head)
1385 allocate(linklist_head%value(num(3)))
1386 nullify(linklist_head%next)
1388 linklist_head%id = 1
1389 linklist_head%name = varname
1390 call backup_array(linklist_head%value(num(0)+1:num(1)), a1, len(1))
1391 call backup_array(linklist_head%value(num(1)+1:num(2)), a2, len(2))
1392 call backup_array(linklist_head%value(num(2)+1:num(3)), a3, len(3))
1394 linklist_tail => linklist_head
1397 allocate(current%value(num(3)))
1398 nullify(current%next)
1399 current%id = linklist_head%id + 1
1400 current%name = varname
1401 call backup_array(current%value(num(0)+1:num(1)), a1, len(1))
1402 call backup_array(current%value(num(1)+1:num(2)), a2, len(2))
1403 call backup_array(current%value(num(2)+1:num(3)), a3, len(3))
1404 current%next => linklist_head
1405 linklist_head => current
1408 ! write(unit=*, fmt='(a,i4,3a)') &
1409 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
1411 end subroutine push_2d_3_arrays
1413 subroutine pop_2d_3_arrays(a1, a2, a3, varname)
1417 real, dimension(:,:), intent(out) :: a1, a2, a3
1418 character(len=*), intent(in) :: varname
1420 type(linked_list), pointer :: current
1423 integer, dimension(3) :: len
1424 integer, dimension(0:3) :: num
1432 num(n) = num(n-1) + len(n)
1435 current => linklist_head
1437 if(trim(current%name) /= trim(varname)) then
1438 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
1439 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
1443 ! write(unit=*, fmt='(a,i4,3a)') &
1444 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
1446 call restore_array(a1, current%value(num(0)+1:num(1)), len(1))
1447 call restore_array(a2, current%value(num(1)+1:num(2)), len(2))
1448 call restore_array(a3, current%value(num(2)+1:num(3)), len(3))
1450 current => current%next
1452 nullify(linklist_head%next)
1453 deallocate(linklist_head%value)
1454 deallocate(linklist_head)
1455 linklist_head => current
1457 end subroutine pop_2d_3_arrays
1459 subroutine push_2d_4_arrays(a1, a2, a3, a4, varname)
1463 real, dimension(:,:), intent(in) :: a1, a2, a3, a4
1464 character(len=*), intent(in) :: varname
1466 type(linked_list), pointer :: current
1469 integer, dimension(4) :: len
1470 integer, dimension(0:4) :: num
1479 num(n) = num(n-1) + len(n)
1482 if(.not. associated(linklist_head)) then
1483 nullify(linklist_head)
1485 allocate(linklist_head)
1486 allocate(linklist_head%value(num(4)))
1487 nullify(linklist_head%next)
1489 linklist_head%id = 1
1490 linklist_head%name = varname
1491 call backup_array(linklist_head%value(num(0)+1:num(1)), a1, len(1))
1492 call backup_array(linklist_head%value(num(1)+1:num(2)), a2, len(2))
1493 call backup_array(linklist_head%value(num(2)+1:num(3)), a3, len(3))
1494 call backup_array(linklist_head%value(num(3)+1:num(4)), a4, len(4))
1496 linklist_tail => linklist_head
1499 allocate(current%value(num(4)))
1500 nullify(current%next)
1501 current%id = linklist_head%id + 1
1502 current%name = varname
1503 call backup_array(current%value(num(0)+1:num(1)), a1, len(1))
1504 call backup_array(current%value(num(1)+1:num(2)), a2, len(2))
1505 call backup_array(current%value(num(2)+1:num(3)), a3, len(3))
1506 call backup_array(current%value(num(3)+1:num(4)), a4, len(4))
1507 current%next => linklist_head
1508 linklist_head => current
1511 ! write(unit=*, fmt='(a,i4,3a)') &
1512 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
1514 end subroutine push_2d_4_arrays
1516 subroutine pop_2d_4_arrays(a1, a2, a3, a4, varname)
1520 real, dimension(:,:), intent(out) :: a1, a2, a3, a4
1521 character(len=*), intent(in) :: varname
1523 type(linked_list), pointer :: current
1526 integer, dimension(4) :: len
1527 integer, dimension(0:4) :: num
1536 num(n) = num(n-1) + len(n)
1539 current => linklist_head
1541 if(trim(current%name) /= trim(varname)) then
1542 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
1543 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
1547 ! write(unit=*, fmt='(a,i4,3a)') &
1548 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
1550 call restore_array(a1, current%value(num(0)+1:num(1)), len(1))
1551 call restore_array(a2, current%value(num(1)+1:num(2)), len(2))
1552 call restore_array(a3, current%value(num(2)+1:num(3)), len(3))
1553 call restore_array(a4, current%value(num(3)+1:num(4)), len(4))
1555 current => current%next
1557 nullify(linklist_head%next)
1558 deallocate(linklist_head%value)
1559 deallocate(linklist_head)
1560 linklist_head => current
1562 end subroutine pop_2d_4_arrays
1564 subroutine push_2d_5_arrays(a1, a2, a3, a4, a5, varname)
1568 real, dimension(:,:), intent(in) :: a1, a2, a3, a4, a5
1569 character(len=*), intent(in) :: varname
1571 type(linked_list), pointer :: current
1574 integer, dimension(5) :: len
1575 integer, dimension(0:5) :: num
1585 num(n) = num(n-1) + len(n)
1588 if(.not. associated(linklist_head)) then
1589 nullify(linklist_head)
1591 allocate(linklist_head)
1592 allocate(linklist_head%value(num(5)))
1593 nullify(linklist_head%next)
1595 linklist_head%id = 1
1596 linklist_head%name = varname
1597 call backup_array(linklist_head%value(num(0)+1:num(1)), a1, len(1))
1598 call backup_array(linklist_head%value(num(1)+1:num(2)), a2, len(2))
1599 call backup_array(linklist_head%value(num(2)+1:num(3)), a3, len(3))
1600 call backup_array(linklist_head%value(num(3)+1:num(4)), a4, len(4))
1601 call backup_array(linklist_head%value(num(4)+1:num(5)), a5, len(5))
1603 linklist_tail => linklist_head
1606 allocate(current%value(num(5)))
1607 nullify(current%next)
1608 current%id = linklist_head%id + 1
1609 current%name = varname
1610 call backup_array(current%value(num(0)+1:num(1)), a1, len(1))
1611 call backup_array(current%value(num(1)+1:num(2)), a2, len(2))
1612 call backup_array(current%value(num(2)+1:num(3)), a3, len(3))
1613 call backup_array(current%value(num(3)+1:num(4)), a4, len(4))
1614 call backup_array(current%value(num(4)+1:num(5)), a5, len(5))
1615 current%next => linklist_head
1616 linklist_head => current
1619 ! write(unit=*, fmt='(a,i4,3a)') &
1620 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
1622 end subroutine push_2d_5_arrays
1624 subroutine pop_2d_5_arrays(a1, a2, a3, a4, a5, varname)
1628 real, dimension(:,:), intent(out) :: a1, a2, a3, a4, a5
1629 character(len=*), intent(in) :: varname
1631 type(linked_list), pointer :: current
1634 integer, dimension(5) :: len
1635 integer, dimension(0:5) :: num
1645 num(n) = num(n-1) + len(n)
1648 current => linklist_head
1650 if(trim(current%name) /= trim(varname)) then
1651 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
1652 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
1656 ! write(unit=*, fmt='(a,i4,3a)') &
1657 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
1659 call restore_array(a1, current%value(num(0)+1:num(1)), len(1))
1660 call restore_array(a2, current%value(num(1)+1:num(2)), len(2))
1661 call restore_array(a3, current%value(num(2)+1:num(3)), len(3))
1662 call restore_array(a4, current%value(num(3)+1:num(4)), len(4))
1663 call restore_array(a5, current%value(num(4)+1:num(5)), len(5))
1665 current => current%next
1667 nullify(linklist_head%next)
1668 deallocate(linklist_head%value)
1669 deallocate(linklist_head)
1670 linklist_head => current
1672 end subroutine pop_2d_5_arrays
1674 subroutine push_2d_6_arrays(a1, a2, a3, a4, a5, a6, varname)
1678 real, dimension(:,:), intent(in) :: a1, a2, a3, a4, a5, a6
1679 character(len=*), intent(in) :: varname
1681 type(linked_list), pointer :: current
1684 integer, dimension(6) :: len
1685 integer, dimension(0:6) :: num
1696 num(n) = num(n-1) + len(n)
1699 if(.not. associated(linklist_head)) then
1700 nullify(linklist_head)
1702 allocate(linklist_head)
1703 allocate(linklist_head%value(num(6)))
1704 nullify(linklist_head%next)
1706 linklist_head%id = 1
1707 linklist_head%name = varname
1708 call backup_array(linklist_head%value(num(0)+1:num(1)), a1, len(1))
1709 call backup_array(linklist_head%value(num(1)+1:num(2)), a2, len(2))
1710 call backup_array(linklist_head%value(num(2)+1:num(3)), a3, len(3))
1711 call backup_array(linklist_head%value(num(3)+1:num(4)), a4, len(4))
1712 call backup_array(linklist_head%value(num(4)+1:num(5)), a5, len(5))
1713 call backup_array(linklist_head%value(num(5)+1:num(6)), a6, len(6))
1715 linklist_tail => linklist_head
1718 allocate(current%value(num(6)))
1719 nullify(current%next)
1720 current%id = linklist_head%id + 1
1721 current%name = varname
1722 call backup_array(current%value(num(0)+1:num(1)), a1, len(1))
1723 call backup_array(current%value(num(1)+1:num(2)), a2, len(2))
1724 call backup_array(current%value(num(2)+1:num(3)), a3, len(3))
1725 call backup_array(current%value(num(3)+1:num(4)), a4, len(4))
1726 call backup_array(current%value(num(4)+1:num(5)), a5, len(5))
1727 call backup_array(current%value(num(5)+1:num(6)), a6, len(6))
1728 current%next => linklist_head
1729 linklist_head => current
1732 ! write(unit=*, fmt='(a,i4,3a)') &
1733 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
1735 end subroutine push_2d_6_arrays
1737 subroutine pop_2d_6_arrays(a1, a2, a3, a4, a5, a6, varname)
1741 real, dimension(:,:), intent(out) :: a1, a2, a3, a4, a5, a6
1742 character(len=*), intent(in) :: varname
1744 type(linked_list), pointer :: current
1747 integer, dimension(6) :: len
1748 integer, dimension(0:6) :: num
1759 num(n) = num(n-1) + len(n)
1762 current => linklist_head
1764 if(trim(current%name) /= trim(varname)) then
1765 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
1766 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
1770 ! write(unit=*, fmt='(a,i4,3a)') &
1771 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
1773 call restore_array(a1, current%value(num(0)+1:num(1)), len(1))
1774 call restore_array(a2, current%value(num(1)+1:num(2)), len(2))
1775 call restore_array(a3, current%value(num(2)+1:num(3)), len(3))
1776 call restore_array(a4, current%value(num(3)+1:num(4)), len(4))
1777 call restore_array(a5, current%value(num(4)+1:num(5)), len(5))
1778 call restore_array(a6, current%value(num(5)+1:num(6)), len(6))
1780 current => current%next
1782 nullify(linklist_head%next)
1783 deallocate(linklist_head%value)
1784 deallocate(linklist_head)
1785 linklist_head => current
1787 end subroutine pop_2d_6_arrays
1789 subroutine push_2d_7_arrays(a1, a2, a3, a4, a5, a6, a7, varname)
1793 real, dimension(:,:), intent(in) :: a1, a2, a3, a4, a5, a6, a7
1794 character(len=*), intent(in) :: varname
1796 type(linked_list), pointer :: current
1799 integer, dimension(7) :: len
1800 integer, dimension(0:7) :: num
1812 num(n) = num(n-1) + len(n)
1815 if(.not. associated(linklist_head)) then
1816 nullify(linklist_head)
1818 allocate(linklist_head)
1819 allocate(linklist_head%value(num(7)))
1820 nullify(linklist_head%next)
1822 linklist_head%id = 1
1823 linklist_head%name = varname
1824 call backup_array(linklist_head%value(num(0)+1:num(1)), a1, len(1))
1825 call backup_array(linklist_head%value(num(1)+1:num(2)), a2, len(2))
1826 call backup_array(linklist_head%value(num(2)+1:num(3)), a3, len(3))
1827 call backup_array(linklist_head%value(num(3)+1:num(4)), a4, len(4))
1828 call backup_array(linklist_head%value(num(4)+1:num(5)), a5, len(5))
1829 call backup_array(linklist_head%value(num(5)+1:num(6)), a6, len(6))
1830 call backup_array(linklist_head%value(num(6)+1:num(7)), a7, len(7))
1832 linklist_tail => linklist_head
1835 allocate(current%value(num(7)))
1836 nullify(current%next)
1837 current%id = linklist_head%id + 1
1838 current%name = varname
1839 call backup_array(current%value(num(0)+1:num(1)), a1, len(1))
1840 call backup_array(current%value(num(1)+1:num(2)), a2, len(2))
1841 call backup_array(current%value(num(2)+1:num(3)), a3, len(3))
1842 call backup_array(current%value(num(3)+1:num(4)), a4, len(4))
1843 call backup_array(current%value(num(4)+1:num(5)), a5, len(5))
1844 call backup_array(current%value(num(5)+1:num(6)), a6, len(6))
1845 call backup_array(current%value(num(6)+1:num(7)), a7, len(7))
1846 current%next => linklist_head
1847 linklist_head => current
1850 ! write(unit=*, fmt='(a,i4,3a)') &
1851 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
1853 end subroutine push_2d_7_arrays
1855 subroutine pop_2d_7_arrays(a1, a2, a3, a4, a5, a6, a7, varname)
1859 real, dimension(:,:), intent(out) :: a1, a2, a3, a4, a5, a6, a7
1860 character(len=*), intent(in) :: varname
1862 type(linked_list), pointer :: current
1865 integer, dimension(7) :: len
1866 integer, dimension(0:7) :: num
1878 num(n) = num(n-1) + len(n)
1881 current => linklist_head
1883 if(trim(current%name) /= trim(varname)) then
1884 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
1885 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
1889 ! write(unit=*, fmt='(a,i4,3a)') &
1890 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
1892 call restore_array(a1, current%value(num(0)+1:num(1)), len(1))
1893 call restore_array(a2, current%value(num(1)+1:num(2)), len(2))
1894 call restore_array(a3, current%value(num(2)+1:num(3)), len(3))
1895 call restore_array(a4, current%value(num(3)+1:num(4)), len(4))
1896 call restore_array(a5, current%value(num(4)+1:num(5)), len(5))
1897 call restore_array(a6, current%value(num(5)+1:num(6)), len(6))
1898 call restore_array(a7, current%value(num(6)+1:num(7)), len(7))
1900 current => current%next
1902 nullify(linklist_head%next)
1903 deallocate(linklist_head%value)
1904 deallocate(linklist_head)
1905 linklist_head => current
1907 end subroutine pop_2d_7_arrays
1909 subroutine push_2d_8_arrays(a1, a2, a3, a4, a5, a6, a7, a8, varname)
1913 real, dimension(:,:), intent(in) :: a1, a2, a3, a4, a5, a6, a7, a8
1914 character(len=*), intent(in) :: varname
1916 type(linked_list), pointer :: current
1919 integer, dimension(8) :: len
1920 integer, dimension(0:8) :: num
1933 num(n) = num(n-1) + len(n)
1936 if(.not. associated(linklist_head)) then
1937 nullify(linklist_head)
1939 allocate(linklist_head)
1940 allocate(linklist_head%value(num(8)))
1941 nullify(linklist_head%next)
1943 linklist_head%id = 1
1944 linklist_head%name = varname
1945 call backup_array(linklist_head%value(num(0)+1:num(1)), a1, len(1))
1946 call backup_array(linklist_head%value(num(1)+1:num(2)), a2, len(2))
1947 call backup_array(linklist_head%value(num(2)+1:num(3)), a3, len(3))
1948 call backup_array(linklist_head%value(num(3)+1:num(4)), a4, len(4))
1949 call backup_array(linklist_head%value(num(4)+1:num(5)), a5, len(5))
1950 call backup_array(linklist_head%value(num(5)+1:num(6)), a6, len(6))
1951 call backup_array(linklist_head%value(num(6)+1:num(7)), a7, len(7))
1952 call backup_array(linklist_head%value(num(7)+1:num(8)), a8, len(8))
1954 linklist_tail => linklist_head
1957 allocate(current%value(num(8)))
1958 nullify(current%next)
1959 current%id = linklist_head%id + 1
1960 current%name = varname
1961 call backup_array(current%value(num(0)+1:num(1)), a1, len(1))
1962 call backup_array(current%value(num(1)+1:num(2)), a2, len(2))
1963 call backup_array(current%value(num(2)+1:num(3)), a3, len(3))
1964 call backup_array(current%value(num(3)+1:num(4)), a4, len(4))
1965 call backup_array(current%value(num(4)+1:num(5)), a5, len(5))
1966 call backup_array(current%value(num(5)+1:num(6)), a6, len(6))
1967 call backup_array(current%value(num(6)+1:num(7)), a7, len(7))
1968 call backup_array(current%value(num(7)+1:num(8)), a8, len(8))
1969 current%next => linklist_head
1970 linklist_head => current
1973 ! write(unit=*, fmt='(a,i4,3a)') &
1974 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
1976 end subroutine push_2d_8_arrays
1978 subroutine pop_2d_8_arrays(a1, a2, a3, a4, a5, a6, a7, a8, varname)
1982 real, dimension(:,:), intent(out) :: a1, a2, a3, a4, a5, a6, a7, a8
1983 character(len=*), intent(in) :: varname
1985 type(linked_list), pointer :: current
1988 integer, dimension(8) :: len
1989 integer, dimension(0:8) :: num
2002 num(n) = num(n-1) + len(n)
2005 current => linklist_head
2007 if(trim(current%name) /= trim(varname)) then
2008 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
2009 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
2013 ! write(unit=*, fmt='(a,i4,3a)') &
2014 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
2016 call restore_array(a1, current%value(num(0)+1:num(1)), len(1))
2017 call restore_array(a2, current%value(num(1)+1:num(2)), len(2))
2018 call restore_array(a3, current%value(num(2)+1:num(3)), len(3))
2019 call restore_array(a4, current%value(num(3)+1:num(4)), len(4))
2020 call restore_array(a5, current%value(num(4)+1:num(5)), len(5))
2021 call restore_array(a6, current%value(num(5)+1:num(6)), len(6))
2022 call restore_array(a7, current%value(num(6)+1:num(7)), len(7))
2023 call restore_array(a8, current%value(num(7)+1:num(8)), len(8))
2025 current => current%next
2027 nullify(linklist_head%next)
2028 deallocate(linklist_head%value)
2029 deallocate(linklist_head)
2030 linklist_head => current
2032 end subroutine pop_2d_8_arrays
2034 subroutine push_2d_9_arrays(a1, a2, a3, a4, a5, a6, a7, a8, a9, varname)
2038 real, dimension(:,:), intent(in) :: a1, a2, a3, a4, a5, a6, a7, a8, a9
2039 character(len=*), intent(in) :: varname
2041 type(linked_list), pointer :: current
2044 integer, dimension(9) :: len
2045 integer, dimension(0:9) :: num
2059 num(n) = num(n-1) + len(n)
2062 if(.not. associated(linklist_head)) then
2063 nullify(linklist_head)
2065 allocate(linklist_head)
2066 allocate(linklist_head%value(num(9)))
2067 nullify(linklist_head%next)
2069 linklist_head%id = 1
2070 linklist_head%name = varname
2071 call backup_array(linklist_head%value(num(0)+1:num(1)), a1, len(1))
2072 call backup_array(linklist_head%value(num(1)+1:num(2)), a2, len(2))
2073 call backup_array(linklist_head%value(num(2)+1:num(3)), a3, len(3))
2074 call backup_array(linklist_head%value(num(3)+1:num(4)), a4, len(4))
2075 call backup_array(linklist_head%value(num(4)+1:num(5)), a5, len(5))
2076 call backup_array(linklist_head%value(num(5)+1:num(6)), a6, len(6))
2077 call backup_array(linklist_head%value(num(6)+1:num(7)), a7, len(7))
2078 call backup_array(linklist_head%value(num(7)+1:num(8)), a8, len(8))
2079 call backup_array(linklist_head%value(num(8)+1:num(9)), a9, len(9))
2081 linklist_tail => linklist_head
2084 allocate(current%value(num(9)))
2085 nullify(current%next)
2086 current%id = linklist_head%id + 1
2087 current%name = varname
2088 call backup_array(current%value(num(0)+1:num(1)), a1, len(1))
2089 call backup_array(current%value(num(1)+1:num(2)), a2, len(2))
2090 call backup_array(current%value(num(2)+1:num(3)), a3, len(3))
2091 call backup_array(current%value(num(3)+1:num(4)), a4, len(4))
2092 call backup_array(current%value(num(4)+1:num(5)), a5, len(5))
2093 call backup_array(current%value(num(5)+1:num(6)), a6, len(6))
2094 call backup_array(current%value(num(6)+1:num(7)), a7, len(7))
2095 call backup_array(current%value(num(7)+1:num(8)), a8, len(8))
2096 call backup_array(current%value(num(8)+1:num(9)), a9, len(9))
2097 current%next => linklist_head
2098 linklist_head => current
2101 ! write(unit=*, fmt='(a,i4,3a)') &
2102 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
2104 end subroutine push_2d_9_arrays
2106 subroutine pop_2d_9_arrays(a1, a2, a3, a4, a5, a6, a7, a8, a9, varname)
2110 real, dimension(:,:), intent(out) :: a1, a2, a3, a4, a5, a6, a7, a8, a9
2111 character(len=*), intent(in) :: varname
2113 type(linked_list), pointer :: current
2116 integer, dimension(9) :: len
2117 integer, dimension(0:9) :: num
2131 num(n) = num(n-1) + len(n)
2134 current => linklist_head
2136 if(trim(current%name) /= trim(varname)) then
2137 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
2138 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
2142 ! write(unit=*, fmt='(a,i4,3a)') &
2143 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
2145 call restore_array(a1, current%value(num(0)+1:num(1)), len(1))
2146 call restore_array(a2, current%value(num(1)+1:num(2)), len(2))
2147 call restore_array(a3, current%value(num(2)+1:num(3)), len(3))
2148 call restore_array(a4, current%value(num(3)+1:num(4)), len(4))
2149 call restore_array(a5, current%value(num(4)+1:num(5)), len(5))
2150 call restore_array(a6, current%value(num(5)+1:num(6)), len(6))
2151 call restore_array(a7, current%value(num(6)+1:num(7)), len(7))
2152 call restore_array(a8, current%value(num(7)+1:num(8)), len(8))
2153 call restore_array(a9, current%value(num(8)+1:num(9)), len(9))
2155 current => current%next
2157 nullify(linklist_head%next)
2158 deallocate(linklist_head%value)
2159 deallocate(linklist_head)
2160 linklist_head => current
2162 end subroutine pop_2d_9_arrays
2164 subroutine push_2d_10_arrays(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, varname)
2168 real, dimension(:,:), intent(in) :: a1, a2, a3, a4, a5, a6, a7, a8, a9, a10
2169 character(len=*), intent(in) :: varname
2171 type(linked_list), pointer :: current
2174 integer, dimension(10) :: len
2175 integer, dimension(0:10) :: num
2190 num(n) = num(n-1) + len(n)
2193 if(.not. associated(linklist_head)) then
2194 nullify(linklist_head)
2196 allocate(linklist_head)
2197 allocate(linklist_head%value(num(10)))
2198 nullify(linklist_head%next)
2200 linklist_head%id = 1
2201 linklist_head%name = varname
2202 call backup_array(linklist_head%value(num(0)+1:num(1)), a1, len(1))
2203 call backup_array(linklist_head%value(num(1)+1:num(2)), a2, len(2))
2204 call backup_array(linklist_head%value(num(2)+1:num(3)), a3, len(3))
2205 call backup_array(linklist_head%value(num(3)+1:num(4)), a4, len(4))
2206 call backup_array(linklist_head%value(num(4)+1:num(5)), a5, len(5))
2207 call backup_array(linklist_head%value(num(5)+1:num(6)), a6, len(6))
2208 call backup_array(linklist_head%value(num(6)+1:num(7)), a7, len(7))
2209 call backup_array(linklist_head%value(num(7)+1:num(8)), a8, len(8))
2210 call backup_array(linklist_head%value(num(8)+1:num(9)), a9, len(9))
2211 call backup_array(linklist_head%value(num(9)+1:num(10)), a10, len(10))
2213 linklist_tail => linklist_head
2216 allocate(current%value(num(10)))
2217 nullify(current%next)
2218 current%id = linklist_head%id + 1
2219 current%name = varname
2220 call backup_array(current%value(num(0)+1:num(1)), a1, len(1))
2221 call backup_array(current%value(num(1)+1:num(2)), a2, len(2))
2222 call backup_array(current%value(num(2)+1:num(3)), a3, len(3))
2223 call backup_array(current%value(num(3)+1:num(4)), a4, len(4))
2224 call backup_array(current%value(num(4)+1:num(5)), a5, len(5))
2225 call backup_array(current%value(num(5)+1:num(6)), a6, len(6))
2226 call backup_array(current%value(num(6)+1:num(7)), a7, len(7))
2227 call backup_array(current%value(num(7)+1:num(8)), a8, len(8))
2228 call backup_array(current%value(num(8)+1:num(9)), a9, len(9))
2229 call backup_array(current%value(num(9)+1:num(10)), a10, len(10))
2230 current%next => linklist_head
2231 linklist_head => current
2234 ! write(unit=*, fmt='(a,i4,3a)') &
2235 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
2237 end subroutine push_2d_10_arrays
2239 subroutine pop_2d_10_arrays(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, varname)
2243 real, dimension(:,:), intent(out) :: a1, a2, a3, a4, a5, a6, a7, a8, a9, a10
2244 character(len=*), intent(in) :: varname
2246 type(linked_list), pointer :: current
2249 integer, dimension(10) :: len
2250 integer, dimension(0:10) :: num
2265 num(n) = num(n-1) + len(n)
2268 current => linklist_head
2270 if(trim(current%name) /= trim(varname)) then
2271 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
2272 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
2276 ! write(unit=*, fmt='(a,i4,3a)') &
2277 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
2279 call restore_array(a1, current%value(num(0)+1:num(1)), len(1))
2280 call restore_array(a2, current%value(num(1)+1:num(2)), len(2))
2281 call restore_array(a3, current%value(num(2)+1:num(3)), len(3))
2282 call restore_array(a4, current%value(num(3)+1:num(4)), len(4))
2283 call restore_array(a5, current%value(num(4)+1:num(5)), len(5))
2284 call restore_array(a6, current%value(num(5)+1:num(6)), len(6))
2285 call restore_array(a7, current%value(num(6)+1:num(7)), len(7))
2286 call restore_array(a8, current%value(num(7)+1:num(8)), len(8))
2287 call restore_array(a9, current%value(num(8)+1:num(9)), len(9))
2288 call restore_array(a10, current%value(num(9)+1:num(10)), len(10))
2290 current => current%next
2292 nullify(linklist_head%next)
2293 deallocate(linklist_head%value)
2294 deallocate(linklist_head)
2295 linklist_head => current
2297 end subroutine pop_2d_10_arrays
2299 subroutine push_3d_1_array(a1, varname)
2303 real, dimension(:,:,:), intent(in) :: a1
2304 character(len=*), intent(in) :: varname
2308 type(linked_list), pointer :: current
2312 if(.not. associated(linklist_head)) then
2313 nullify(linklist_head)
2315 allocate(linklist_head)
2316 allocate(linklist_head%value(length))
2317 nullify(linklist_head%next)
2319 linklist_head%id = 1
2320 linklist_head%name = varname
2321 call backup_array(linklist_head%value, a1, length)
2323 linklist_tail => linklist_head
2326 allocate(current%value(length))
2327 nullify(current%next)
2328 current%id = linklist_head%id + 1
2329 current%name = varname
2330 call backup_array(current%value, a1, length)
2331 current%next => linklist_head
2332 linklist_head => current
2335 ! write(unit=*, fmt='(a,i4,3a)') &
2336 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
2338 end subroutine push_3d_1_array
2340 subroutine pop_3d_1_array(a1, varname)
2344 real, dimension(:,:,:), intent(out) :: a1
2345 character(len=*), intent(in) :: varname
2349 type(linked_list), pointer :: current
2353 current => linklist_head
2355 if(trim(current%name) /= trim(varname)) then
2356 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
2357 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
2361 ! write(unit=*, fmt='(a,i4,3a)') &
2362 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
2364 call restore_array(a1, current%value, length)
2366 current => current%next
2368 nullify(linklist_head%next)
2369 deallocate(linklist_head%value)
2370 deallocate(linklist_head)
2371 linklist_head => current
2373 end subroutine pop_3d_1_array
2375 subroutine push_3d_2_arrays(a1, a2, varname)
2379 real, dimension(:,:,:), intent(in) :: a1, a2
2380 character(len=*), intent(in) :: varname
2382 type(linked_list), pointer :: current
2385 integer, dimension(2) :: len
2386 integer, dimension(0:2) :: num
2393 num(n) = num(n-1) + len(n)
2396 if(.not. associated(linklist_head)) then
2397 nullify(linklist_head)
2399 allocate(linklist_head)
2400 allocate(linklist_head%value(num(2)))
2401 nullify(linklist_head%next)
2403 linklist_head%id = 1
2404 linklist_head%name = varname
2405 call backup_array(linklist_head%value(num(0)+1:num(1)), a1, len(1))
2406 call backup_array(linklist_head%value(num(1)+1:num(2)), a2, len(2))
2408 linklist_tail => linklist_head
2411 allocate(current%value(num(2)))
2412 nullify(current%next)
2413 current%id = linklist_head%id + 1
2414 current%name = varname
2415 call backup_array(current%value(num(0)+1:num(1)), a1, len(1))
2416 call backup_array(current%value(num(1)+1:num(2)), a2, len(2))
2417 current%next => linklist_head
2418 linklist_head => current
2421 ! write(unit=*, fmt='(a,i4,3a)') &
2422 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
2424 end subroutine push_3d_2_arrays
2426 subroutine pop_3d_2_arrays(a1, a2, varname)
2430 real, dimension(:,:,:), intent(out) :: a1, a2
2431 character(len=*), intent(in) :: varname
2433 type(linked_list), pointer :: current
2436 integer, dimension(2) :: len
2437 integer, dimension(0:2) :: num
2444 num(n) = num(n-1) + len(n)
2447 current => linklist_head
2449 if(trim(current%name) /= trim(varname)) then
2450 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
2451 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
2455 ! write(unit=*, fmt='(a,i4,3a)') &
2456 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
2458 call restore_array(a1, current%value(num(0)+1:num(1)), len(1))
2459 call restore_array(a2, current%value(num(1)+1:num(2)), len(2))
2461 current => current%next
2463 nullify(linklist_head%next)
2464 deallocate(linklist_head%value)
2465 deallocate(linklist_head)
2466 linklist_head => current
2468 end subroutine pop_3d_2_arrays
2470 subroutine push_3d_3_arrays(a1, a2, a3, varname)
2474 real, dimension(:,:,:), intent(in) :: a1, a2, a3
2475 character(len=*), intent(in) :: varname
2477 type(linked_list), pointer :: current
2480 integer, dimension(3) :: len
2481 integer, dimension(0:3) :: num
2489 num(n) = num(n-1) + len(n)
2492 if(.not. associated(linklist_head)) then
2493 nullify(linklist_head)
2495 allocate(linklist_head)
2496 allocate(linklist_head%value(num(3)))
2497 nullify(linklist_head%next)
2499 linklist_head%id = 1
2500 linklist_head%name = varname
2501 call backup_array(linklist_head%value(num(0)+1:num(1)), a1, len(1))
2502 call backup_array(linklist_head%value(num(1)+1:num(2)), a2, len(2))
2503 call backup_array(linklist_head%value(num(2)+1:num(3)), a3, len(3))
2505 linklist_tail => linklist_head
2508 allocate(current%value(num(3)))
2509 nullify(current%next)
2510 current%id = linklist_head%id + 1
2511 current%name = varname
2512 call backup_array(current%value(num(0)+1:num(1)), a1, len(1))
2513 call backup_array(current%value(num(1)+1:num(2)), a2, len(2))
2514 call backup_array(current%value(num(2)+1:num(3)), a3, len(3))
2515 current%next => linklist_head
2516 linklist_head => current
2519 ! write(unit=*, fmt='(a,i4,3a)') &
2520 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
2522 end subroutine push_3d_3_arrays
2524 subroutine pop_3d_3_arrays(a1, a2, a3, varname)
2528 real, dimension(:,:,:), intent(out) :: a1, a2, a3
2529 character(len=*), intent(in) :: varname
2531 type(linked_list), pointer :: current
2534 integer, dimension(3) :: len
2535 integer, dimension(0:3) :: num
2543 num(n) = num(n-1) + len(n)
2546 current => linklist_head
2548 if(trim(current%name) /= trim(varname)) then
2549 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
2550 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
2554 ! write(unit=*, fmt='(a,i4,3a)') &
2555 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
2557 call restore_array(a1, current%value(num(0)+1:num(1)), len(1))
2558 call restore_array(a2, current%value(num(1)+1:num(2)), len(2))
2559 call restore_array(a3, current%value(num(2)+1:num(3)), len(3))
2561 current => current%next
2563 nullify(linklist_head%next)
2564 deallocate(linklist_head%value)
2565 deallocate(linklist_head)
2566 linklist_head => current
2568 end subroutine pop_3d_3_arrays
2570 subroutine push_3d_4_arrays(a1, a2, a3, a4, varname)
2574 real, dimension(:,:,:), intent(in) :: a1, a2, a3, a4
2575 character(len=*), intent(in) :: varname
2577 type(linked_list), pointer :: current
2580 integer, dimension(4) :: len
2581 integer, dimension(0:4) :: num
2590 num(n) = num(n-1) + len(n)
2593 if(.not. associated(linklist_head)) then
2594 nullify(linklist_head)
2596 allocate(linklist_head)
2597 allocate(linklist_head%value(num(4)))
2598 nullify(linklist_head%next)
2600 linklist_head%id = 1
2601 linklist_head%name = varname
2602 call backup_array(linklist_head%value(num(0)+1:num(1)), a1, len(1))
2603 call backup_array(linklist_head%value(num(1)+1:num(2)), a2, len(2))
2604 call backup_array(linklist_head%value(num(2)+1:num(3)), a3, len(3))
2605 call backup_array(linklist_head%value(num(3)+1:num(4)), a4, len(4))
2607 linklist_tail => linklist_head
2610 allocate(current%value(num(4)))
2611 nullify(current%next)
2612 current%id = linklist_head%id + 1
2613 current%name = varname
2614 call backup_array(current%value(num(0)+1:num(1)), a1, len(1))
2615 call backup_array(current%value(num(1)+1:num(2)), a2, len(2))
2616 call backup_array(current%value(num(2)+1:num(3)), a3, len(3))
2617 call backup_array(current%value(num(3)+1:num(4)), a4, len(4))
2618 current%next => linklist_head
2619 linklist_head => current
2622 ! write(unit=*, fmt='(a,i4,3a)') &
2623 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
2625 end subroutine push_3d_4_arrays
2627 subroutine pop_3d_4_arrays(a1, a2, a3, a4, varname)
2631 real, dimension(:,:,:), intent(out) :: a1, a2, a3, a4
2632 character(len=*), intent(in) :: varname
2634 type(linked_list), pointer :: current
2637 integer, dimension(4) :: len
2638 integer, dimension(0:4) :: num
2647 num(n) = num(n-1) + len(n)
2650 current => linklist_head
2652 if(trim(current%name) /= trim(varname)) then
2653 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
2654 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
2658 ! write(unit=*, fmt='(a,i4,3a)') &
2659 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
2661 call restore_array(a1, current%value(num(0)+1:num(1)), len(1))
2662 call restore_array(a2, current%value(num(1)+1:num(2)), len(2))
2663 call restore_array(a3, current%value(num(2)+1:num(3)), len(3))
2664 call restore_array(a4, current%value(num(3)+1:num(4)), len(4))
2666 current => current%next
2668 nullify(linklist_head%next)
2669 deallocate(linklist_head%value)
2670 deallocate(linklist_head)
2671 linklist_head => current
2673 end subroutine pop_3d_4_arrays
2675 subroutine push_3d_5_arrays(a1, a2, a3, a4, a5, varname)
2679 real, dimension(:,:,:), intent(in) :: a1, a2, a3, a4, a5
2680 character(len=*), intent(in) :: varname
2682 type(linked_list), pointer :: current
2685 integer, dimension(5) :: len
2686 integer, dimension(0:5) :: num
2696 num(n) = num(n-1) + len(n)
2699 if(.not. associated(linklist_head)) then
2700 nullify(linklist_head)
2702 allocate(linklist_head)
2703 allocate(linklist_head%value(num(5)))
2704 nullify(linklist_head%next)
2706 linklist_head%id = 1
2707 linklist_head%name = varname
2708 call backup_array(linklist_head%value(num(0)+1:num(1)), a1, len(1))
2709 call backup_array(linklist_head%value(num(1)+1:num(2)), a2, len(2))
2710 call backup_array(linklist_head%value(num(2)+1:num(3)), a3, len(3))
2711 call backup_array(linklist_head%value(num(3)+1:num(4)), a4, len(4))
2712 call backup_array(linklist_head%value(num(4)+1:num(5)), a5, len(5))
2714 linklist_tail => linklist_head
2717 allocate(current%value(num(5)))
2718 nullify(current%next)
2719 current%id = linklist_head%id + 1
2720 current%name = varname
2721 call backup_array(current%value(num(0)+1:num(1)), a1, len(1))
2722 call backup_array(current%value(num(1)+1:num(2)), a2, len(2))
2723 call backup_array(current%value(num(2)+1:num(3)), a3, len(3))
2724 call backup_array(current%value(num(3)+1:num(4)), a4, len(4))
2725 call backup_array(current%value(num(4)+1:num(5)), a5, len(5))
2726 current%next => linklist_head
2727 linklist_head => current
2730 ! write(unit=*, fmt='(a,i4,3a)') &
2731 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
2733 end subroutine push_3d_5_arrays
2735 subroutine pop_3d_5_arrays(a1, a2, a3, a4, a5, varname)
2739 real, dimension(:,:,:), intent(out) :: a1, a2, a3, a4, a5
2740 character(len=*), intent(in) :: varname
2742 type(linked_list), pointer :: current
2745 integer, dimension(5) :: len
2746 integer, dimension(0:5) :: num
2756 num(n) = num(n-1) + len(n)
2759 current => linklist_head
2761 if(trim(current%name) /= trim(varname)) then
2762 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
2763 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
2767 ! write(unit=*, fmt='(a,i4,3a)') &
2768 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
2770 call restore_array(a1, current%value(num(0)+1:num(1)), len(1))
2771 call restore_array(a2, current%value(num(1)+1:num(2)), len(2))
2772 call restore_array(a3, current%value(num(2)+1:num(3)), len(3))
2773 call restore_array(a4, current%value(num(3)+1:num(4)), len(4))
2774 call restore_array(a5, current%value(num(4)+1:num(5)), len(5))
2776 current => current%next
2778 nullify(linklist_head%next)
2779 deallocate(linklist_head%value)
2780 deallocate(linklist_head)
2781 linklist_head => current
2783 end subroutine pop_3d_5_arrays
2785 subroutine push_3d_6_arrays(a1, a2, a3, a4, a5, a6, varname)
2789 real, dimension(:,:,:), intent(in) :: a1, a2, a3, a4, a5, a6
2790 character(len=*), intent(in) :: varname
2792 type(linked_list), pointer :: current
2795 integer, dimension(6) :: len
2796 integer, dimension(0:6) :: num
2807 num(n) = num(n-1) + len(n)
2810 if(.not. associated(linklist_head)) then
2811 nullify(linklist_head)
2813 allocate(linklist_head)
2814 allocate(linklist_head%value(num(6)))
2815 nullify(linklist_head%next)
2817 linklist_head%id = 1
2818 linklist_head%name = varname
2819 call backup_array(linklist_head%value(num(0)+1:num(1)), a1, len(1))
2820 call backup_array(linklist_head%value(num(1)+1:num(2)), a2, len(2))
2821 call backup_array(linklist_head%value(num(2)+1:num(3)), a3, len(3))
2822 call backup_array(linklist_head%value(num(3)+1:num(4)), a4, len(4))
2823 call backup_array(linklist_head%value(num(4)+1:num(5)), a5, len(5))
2824 call backup_array(linklist_head%value(num(5)+1:num(6)), a6, len(6))
2826 linklist_tail => linklist_head
2829 allocate(current%value(num(6)))
2830 nullify(current%next)
2831 current%id = linklist_head%id + 1
2832 current%name = varname
2833 call backup_array(current%value(num(0)+1:num(1)), a1, len(1))
2834 call backup_array(current%value(num(1)+1:num(2)), a2, len(2))
2835 call backup_array(current%value(num(2)+1:num(3)), a3, len(3))
2836 call backup_array(current%value(num(3)+1:num(4)), a4, len(4))
2837 call backup_array(current%value(num(4)+1:num(5)), a5, len(5))
2838 call backup_array(current%value(num(5)+1:num(6)), a6, len(6))
2839 current%next => linklist_head
2840 linklist_head => current
2843 ! write(unit=*, fmt='(a,i4,3a)') &
2844 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
2846 end subroutine push_3d_6_arrays
2848 subroutine pop_3d_6_arrays(a1, a2, a3, a4, a5, a6, varname)
2852 real, dimension(:,:,:), intent(out) :: a1, a2, a3, a4, a5, a6
2853 character(len=*), intent(in) :: varname
2855 type(linked_list), pointer :: current
2858 integer, dimension(6) :: len
2859 integer, dimension(0:6) :: num
2870 num(n) = num(n-1) + len(n)
2873 current => linklist_head
2875 if(trim(current%name) /= trim(varname)) then
2876 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
2877 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
2881 ! write(unit=*, fmt='(a,i4,3a)') &
2882 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
2884 call restore_array(a1, current%value(num(0)+1:num(1)), len(1))
2885 call restore_array(a2, current%value(num(1)+1:num(2)), len(2))
2886 call restore_array(a3, current%value(num(2)+1:num(3)), len(3))
2887 call restore_array(a4, current%value(num(3)+1:num(4)), len(4))
2888 call restore_array(a5, current%value(num(4)+1:num(5)), len(5))
2889 call restore_array(a6, current%value(num(5)+1:num(6)), len(6))
2891 current => current%next
2893 nullify(linklist_head%next)
2894 deallocate(linklist_head%value)
2895 deallocate(linklist_head)
2896 linklist_head => current
2898 end subroutine pop_3d_6_arrays
2900 subroutine push_3d_7_arrays(a1, a2, a3, a4, a5, a6, a7, varname)
2904 real, dimension(:,:,:), intent(in) :: a1, a2, a3, a4, a5, a6, a7
2905 character(len=*), intent(in) :: varname
2907 type(linked_list), pointer :: current
2910 integer, dimension(7) :: len
2911 integer, dimension(0:7) :: num
2923 num(n) = num(n-1) + len(n)
2926 if(.not. associated(linklist_head)) then
2927 nullify(linklist_head)
2929 allocate(linklist_head)
2930 allocate(linklist_head%value(num(7)))
2931 nullify(linklist_head%next)
2933 linklist_head%id = 1
2934 linklist_head%name = varname
2935 call backup_array(linklist_head%value(num(0)+1:num(1)), a1, len(1))
2936 call backup_array(linklist_head%value(num(1)+1:num(2)), a2, len(2))
2937 call backup_array(linklist_head%value(num(2)+1:num(3)), a3, len(3))
2938 call backup_array(linklist_head%value(num(3)+1:num(4)), a4, len(4))
2939 call backup_array(linklist_head%value(num(4)+1:num(5)), a5, len(5))
2940 call backup_array(linklist_head%value(num(5)+1:num(6)), a6, len(6))
2941 call backup_array(linklist_head%value(num(6)+1:num(7)), a7, len(7))
2943 linklist_tail => linklist_head
2946 allocate(current%value(num(7)))
2947 nullify(current%next)
2948 current%id = linklist_head%id + 1
2949 current%name = varname
2950 call backup_array(current%value(num(0)+1:num(1)), a1, len(1))
2951 call backup_array(current%value(num(1)+1:num(2)), a2, len(2))
2952 call backup_array(current%value(num(2)+1:num(3)), a3, len(3))
2953 call backup_array(current%value(num(3)+1:num(4)), a4, len(4))
2954 call backup_array(current%value(num(4)+1:num(5)), a5, len(5))
2955 call backup_array(current%value(num(5)+1:num(6)), a6, len(6))
2956 call backup_array(current%value(num(6)+1:num(7)), a7, len(7))
2957 current%next => linklist_head
2958 linklist_head => current
2961 ! write(unit=*, fmt='(a,i4,3a)') &
2962 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
2964 end subroutine push_3d_7_arrays
2966 subroutine pop_3d_7_arrays(a1, a2, a3, a4, a5, a6, a7, varname)
2970 real, dimension(:,:,:), intent(out) :: a1, a2, a3, a4, a5, a6, a7
2971 character(len=*), intent(in) :: varname
2973 type(linked_list), pointer :: current
2976 integer, dimension(7) :: len
2977 integer, dimension(0:7) :: num
2989 num(n) = num(n-1) + len(n)
2992 current => linklist_head
2994 if(trim(current%name) /= trim(varname)) then
2995 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
2996 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
3000 ! write(unit=*, fmt='(a,i4,3a)') &
3001 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
3003 call restore_array(a1, current%value(num(0)+1:num(1)), len(1))
3004 call restore_array(a2, current%value(num(1)+1:num(2)), len(2))
3005 call restore_array(a3, current%value(num(2)+1:num(3)), len(3))
3006 call restore_array(a4, current%value(num(3)+1:num(4)), len(4))
3007 call restore_array(a5, current%value(num(4)+1:num(5)), len(5))
3008 call restore_array(a6, current%value(num(5)+1:num(6)), len(6))
3009 call restore_array(a7, current%value(num(6)+1:num(7)), len(7))
3011 current => current%next
3013 nullify(linklist_head%next)
3014 deallocate(linklist_head%value)
3015 deallocate(linklist_head)
3016 linklist_head => current
3018 end subroutine pop_3d_7_arrays
3020 subroutine push_3d_8_arrays(a1, a2, a3, a4, a5, a6, a7, a8, varname)
3024 real, dimension(:,:,:), intent(in) :: a1, a2, a3, a4, a5, a6, a7, a8
3025 character(len=*), intent(in) :: varname
3027 type(linked_list), pointer :: current
3030 integer, dimension(8) :: len
3031 integer, dimension(0:8) :: num
3044 num(n) = num(n-1) + len(n)
3047 if(.not. associated(linklist_head)) then
3048 nullify(linklist_head)
3050 allocate(linklist_head)
3051 allocate(linklist_head%value(num(8)))
3052 nullify(linklist_head%next)
3054 linklist_head%id = 1
3055 linklist_head%name = varname
3056 call backup_array(linklist_head%value(num(0)+1:num(1)), a1, len(1))
3057 call backup_array(linklist_head%value(num(1)+1:num(2)), a2, len(2))
3058 call backup_array(linklist_head%value(num(2)+1:num(3)), a3, len(3))
3059 call backup_array(linklist_head%value(num(3)+1:num(4)), a4, len(4))
3060 call backup_array(linklist_head%value(num(4)+1:num(5)), a5, len(5))
3061 call backup_array(linklist_head%value(num(5)+1:num(6)), a6, len(6))
3062 call backup_array(linklist_head%value(num(6)+1:num(7)), a7, len(7))
3063 call backup_array(linklist_head%value(num(7)+1:num(8)), a8, len(8))
3065 linklist_tail => linklist_head
3068 allocate(current%value(num(8)))
3069 nullify(current%next)
3070 current%id = linklist_head%id + 1
3071 current%name = varname
3072 call backup_array(current%value(num(0)+1:num(1)), a1, len(1))
3073 call backup_array(current%value(num(1)+1:num(2)), a2, len(2))
3074 call backup_array(current%value(num(2)+1:num(3)), a3, len(3))
3075 call backup_array(current%value(num(3)+1:num(4)), a4, len(4))
3076 call backup_array(current%value(num(4)+1:num(5)), a5, len(5))
3077 call backup_array(current%value(num(5)+1:num(6)), a6, len(6))
3078 call backup_array(current%value(num(6)+1:num(7)), a7, len(7))
3079 call backup_array(current%value(num(7)+1:num(8)), a8, len(8))
3080 current%next => linklist_head
3081 linklist_head => current
3084 ! write(unit=*, fmt='(a,i4,3a)') &
3085 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
3087 end subroutine push_3d_8_arrays
3089 subroutine pop_3d_8_arrays(a1, a2, a3, a4, a5, a6, a7, a8, varname)
3093 real, dimension(:,:,:), intent(out) :: a1, a2, a3, a4, a5, a6, a7, a8
3094 character(len=*), intent(in) :: varname
3096 type(linked_list), pointer :: current
3099 integer, dimension(8) :: len
3100 integer, dimension(0:8) :: num
3113 num(n) = num(n-1) + len(n)
3116 current => linklist_head
3118 if(trim(current%name) /= trim(varname)) then
3119 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
3120 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
3124 ! write(unit=*, fmt='(a,i4,3a)') &
3125 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
3127 call restore_array(a1, current%value(num(0)+1:num(1)), len(1))
3128 call restore_array(a2, current%value(num(1)+1:num(2)), len(2))
3129 call restore_array(a3, current%value(num(2)+1:num(3)), len(3))
3130 call restore_array(a4, current%value(num(3)+1:num(4)), len(4))
3131 call restore_array(a5, current%value(num(4)+1:num(5)), len(5))
3132 call restore_array(a6, current%value(num(5)+1:num(6)), len(6))
3133 call restore_array(a7, current%value(num(6)+1:num(7)), len(7))
3134 call restore_array(a8, current%value(num(7)+1:num(8)), len(8))
3136 current => current%next
3138 nullify(linklist_head%next)
3139 deallocate(linklist_head%value)
3140 deallocate(linklist_head)
3141 linklist_head => current
3143 end subroutine pop_3d_8_arrays
3145 subroutine push_3d_9_arrays(a1, a2, a3, a4, a5, a6, a7, a8, a9, varname)
3149 real, dimension(:,:,:), intent(in) :: a1, a2, a3, a4, a5, a6, a7, a8, a9
3150 character(len=*), intent(in) :: varname
3152 type(linked_list), pointer :: current
3155 integer, dimension(9) :: len
3156 integer, dimension(0:9) :: num
3170 num(n) = num(n-1) + len(n)
3173 if(.not. associated(linklist_head)) then
3174 nullify(linklist_head)
3176 allocate(linklist_head)
3177 allocate(linklist_head%value(num(9)))
3178 nullify(linklist_head%next)
3180 linklist_head%id = 1
3181 linklist_head%name = varname
3182 call backup_array(linklist_head%value(num(0)+1:num(1)), a1, len(1))
3183 call backup_array(linklist_head%value(num(1)+1:num(2)), a2, len(2))
3184 call backup_array(linklist_head%value(num(2)+1:num(3)), a3, len(3))
3185 call backup_array(linklist_head%value(num(3)+1:num(4)), a4, len(4))
3186 call backup_array(linklist_head%value(num(4)+1:num(5)), a5, len(5))
3187 call backup_array(linklist_head%value(num(5)+1:num(6)), a6, len(6))
3188 call backup_array(linklist_head%value(num(6)+1:num(7)), a7, len(7))
3189 call backup_array(linklist_head%value(num(7)+1:num(8)), a8, len(8))
3190 call backup_array(linklist_head%value(num(8)+1:num(9)), a9, len(9))
3192 linklist_tail => linklist_head
3195 allocate(current%value(num(9)))
3196 nullify(current%next)
3197 current%id = linklist_head%id + 1
3198 current%name = varname
3199 call backup_array(current%value(num(0)+1:num(1)), a1, len(1))
3200 call backup_array(current%value(num(1)+1:num(2)), a2, len(2))
3201 call backup_array(current%value(num(2)+1:num(3)), a3, len(3))
3202 call backup_array(current%value(num(3)+1:num(4)), a4, len(4))
3203 call backup_array(current%value(num(4)+1:num(5)), a5, len(5))
3204 call backup_array(current%value(num(5)+1:num(6)), a6, len(6))
3205 call backup_array(current%value(num(6)+1:num(7)), a7, len(7))
3206 call backup_array(current%value(num(7)+1:num(8)), a8, len(8))
3207 call backup_array(current%value(num(8)+1:num(9)), a9, len(9))
3208 current%next => linklist_head
3209 linklist_head => current
3212 ! write(unit=*, fmt='(a,i4,3a)') &
3213 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
3215 end subroutine push_3d_9_arrays
3217 subroutine pop_3d_9_arrays(a1, a2, a3, a4, a5, a6, a7, a8, a9, varname)
3221 real, dimension(:,:,:), intent(out) :: a1, a2, a3, a4, a5, a6, a7, a8, a9
3222 character(len=*), intent(in) :: varname
3224 type(linked_list), pointer :: current
3227 integer, dimension(9) :: len
3228 integer, dimension(0:9) :: num
3242 num(n) = num(n-1) + len(n)
3245 current => linklist_head
3247 if(trim(current%name) /= trim(varname)) then
3248 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
3249 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
3253 ! write(unit=*, fmt='(a,i4,3a)') &
3254 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
3256 call restore_array(a1, current%value(num(0)+1:num(1)), len(1))
3257 call restore_array(a2, current%value(num(1)+1:num(2)), len(2))
3258 call restore_array(a3, current%value(num(2)+1:num(3)), len(3))
3259 call restore_array(a4, current%value(num(3)+1:num(4)), len(4))
3260 call restore_array(a5, current%value(num(4)+1:num(5)), len(5))
3261 call restore_array(a6, current%value(num(5)+1:num(6)), len(6))
3262 call restore_array(a7, current%value(num(6)+1:num(7)), len(7))
3263 call restore_array(a8, current%value(num(7)+1:num(8)), len(8))
3264 call restore_array(a9, current%value(num(8)+1:num(9)), len(9))
3266 current => current%next
3268 nullify(linklist_head%next)
3269 deallocate(linklist_head%value)
3270 deallocate(linklist_head)
3271 linklist_head => current
3273 end subroutine pop_3d_9_arrays
3275 subroutine push_3d_10_arrays(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, varname)
3279 real, dimension(:,:,:), intent(in) :: a1, a2, a3, a4, a5, a6, a7, a8, a9, a10
3280 character(len=*), intent(in) :: varname
3282 type(linked_list), pointer :: current
3285 integer, dimension(10) :: len
3286 integer, dimension(0:10) :: num
3301 num(n) = num(n-1) + len(n)
3304 if(.not. associated(linklist_head)) then
3305 nullify(linklist_head)
3307 allocate(linklist_head)
3308 allocate(linklist_head%value(num(10)))
3309 nullify(linklist_head%next)
3311 linklist_head%id = 1
3312 linklist_head%name = varname
3313 call backup_array(linklist_head%value(num(0)+1:num(1)), a1, len(1))
3314 call backup_array(linklist_head%value(num(1)+1:num(2)), a2, len(2))
3315 call backup_array(linklist_head%value(num(2)+1:num(3)), a3, len(3))
3316 call backup_array(linklist_head%value(num(3)+1:num(4)), a4, len(4))
3317 call backup_array(linklist_head%value(num(4)+1:num(5)), a5, len(5))
3318 call backup_array(linklist_head%value(num(5)+1:num(6)), a6, len(6))
3319 call backup_array(linklist_head%value(num(6)+1:num(7)), a7, len(7))
3320 call backup_array(linklist_head%value(num(7)+1:num(8)), a8, len(8))
3321 call backup_array(linklist_head%value(num(8)+1:num(9)), a9, len(9))
3322 call backup_array(linklist_head%value(num(9)+1:num(10)), a10, len(10))
3324 linklist_tail => linklist_head
3327 allocate(current%value(num(10)))
3328 nullify(current%next)
3329 current%id = linklist_head%id + 1
3330 current%name = varname
3331 call backup_array(current%value(num(0)+1:num(1)), a1, len(1))
3332 call backup_array(current%value(num(1)+1:num(2)), a2, len(2))
3333 call backup_array(current%value(num(2)+1:num(3)), a3, len(3))
3334 call backup_array(current%value(num(3)+1:num(4)), a4, len(4))
3335 call backup_array(current%value(num(4)+1:num(5)), a5, len(5))
3336 call backup_array(current%value(num(5)+1:num(6)), a6, len(6))
3337 call backup_array(current%value(num(6)+1:num(7)), a7, len(7))
3338 call backup_array(current%value(num(7)+1:num(8)), a8, len(8))
3339 call backup_array(current%value(num(8)+1:num(9)), a9, len(9))
3340 call backup_array(current%value(num(9)+1:num(10)), a10, len(10))
3341 current%next => linklist_head
3342 linklist_head => current
3345 ! write(unit=*, fmt='(a,i4,3a)') &
3346 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
3348 end subroutine push_3d_10_arrays
3350 subroutine pop_3d_10_arrays(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, varname)
3354 real, dimension(:,:,:), intent(out) :: a1, a2, a3, a4, a5, a6, a7, a8, a9, a10
3355 character(len=*), intent(in) :: varname
3357 type(linked_list), pointer :: current
3360 integer, dimension(10) :: len
3361 integer, dimension(0:10) :: num
3376 num(n) = num(n-1) + len(n)
3379 current => linklist_head
3381 if(trim(current%name) /= trim(varname)) then
3382 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
3383 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
3387 ! write(unit=*, fmt='(a,i4,3a)') &
3388 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
3390 call restore_array(a1, current%value(num(0)+1:num(1)), len(1))
3391 call restore_array(a2, current%value(num(1)+1:num(2)), len(2))
3392 call restore_array(a3, current%value(num(2)+1:num(3)), len(3))
3393 call restore_array(a4, current%value(num(3)+1:num(4)), len(4))
3394 call restore_array(a5, current%value(num(4)+1:num(5)), len(5))
3395 call restore_array(a6, current%value(num(5)+1:num(6)), len(6))
3396 call restore_array(a7, current%value(num(6)+1:num(7)), len(7))
3397 call restore_array(a8, current%value(num(7)+1:num(8)), len(8))
3398 call restore_array(a9, current%value(num(8)+1:num(9)), len(9))
3399 call restore_array(a10, current%value(num(9)+1:num(10)), len(10))
3401 current => current%next
3403 nullify(linklist_head%next)
3404 deallocate(linklist_head%value)
3405 deallocate(linklist_head)
3406 linklist_head => current
3408 end subroutine pop_3d_10_arrays
3410 subroutine push_4d_1_array(a1, varname)
3414 real, dimension(:,:,:,:), intent(in) :: a1
3415 character(len=*), intent(in) :: varname
3419 type(linked_list), pointer :: current
3423 if(.not. associated(linklist_head)) then
3424 nullify(linklist_head)
3426 allocate(linklist_head)
3427 allocate(linklist_head%value(length))
3428 nullify(linklist_head%next)
3430 linklist_head%id = 1
3431 linklist_head%name = varname
3432 call backup_array(linklist_head%value, a1, length)
3434 linklist_tail => linklist_head
3437 allocate(current%value(length))
3438 nullify(current%next)
3439 current%id = linklist_head%id + 1
3440 current%name = varname
3441 call backup_array(current%value, a1, length)
3442 current%next => linklist_head
3443 linklist_head => current
3446 ! write(unit=*, fmt='(a,i4,3a)') &
3447 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
3449 end subroutine push_4d_1_array
3451 subroutine pop_4d_1_array(a1, varname)
3455 real, dimension(:,:,:,:), intent(out) :: a1
3456 character(len=*), intent(in) :: varname
3460 type(linked_list), pointer :: current
3464 current => linklist_head
3466 if(trim(current%name) /= trim(varname)) then
3467 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
3468 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
3472 ! write(unit=*, fmt='(a,i4,3a)') &
3473 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
3475 call restore_array(a1, current%value, length)
3477 current => current%next
3479 nullify(linklist_head%next)
3480 deallocate(linklist_head%value)
3481 deallocate(linklist_head)
3482 linklist_head => current
3484 end subroutine pop_4d_1_array
3486 subroutine push_4d_2_arrays(a1, a2, varname)
3490 real, dimension(:,:,:,:), intent(in) :: a1, a2
3491 character(len=*), intent(in) :: varname
3493 type(linked_list), pointer :: current
3496 integer, dimension(2) :: len
3497 integer, dimension(0:2) :: num
3504 num(n) = num(n-1) + len(n)
3507 if(.not. associated(linklist_head)) then
3508 nullify(linklist_head)
3510 allocate(linklist_head)
3511 allocate(linklist_head%value(num(2)))
3512 nullify(linklist_head%next)
3514 linklist_head%id = 1
3515 linklist_head%name = varname
3516 call backup_array(linklist_head%value(num(0)+1:num(1)), a1, len(1))
3517 call backup_array(linklist_head%value(num(1)+1:num(2)), a2, len(2))
3519 linklist_tail => linklist_head
3522 allocate(current%value(num(2)))
3523 nullify(current%next)
3524 current%id = linklist_head%id + 1
3525 current%name = varname
3526 call backup_array(current%value(num(0)+1:num(1)), a1, len(1))
3527 call backup_array(current%value(num(1)+1:num(2)), a2, len(2))
3528 current%next => linklist_head
3529 linklist_head => current
3532 ! write(unit=*, fmt='(a,i4,3a)') &
3533 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
3535 end subroutine push_4d_2_arrays
3537 subroutine pop_4d_2_arrays(a1, a2, varname)
3541 real, dimension(:,:,:,:), intent(out) :: a1, a2
3542 character(len=*), intent(in) :: varname
3544 type(linked_list), pointer :: current
3547 integer, dimension(2) :: len
3548 integer, dimension(0:2) :: num
3555 num(n) = num(n-1) + len(n)
3558 current => linklist_head
3560 if(trim(current%name) /= trim(varname)) then
3561 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
3562 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
3566 ! write(unit=*, fmt='(a,i4,3a)') &
3567 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
3569 call restore_array(a1, current%value(num(0)+1:num(1)), len(1))
3570 call restore_array(a2, current%value(num(1)+1:num(2)), len(2))
3572 current => current%next
3574 nullify(linklist_head%next)
3575 deallocate(linklist_head%value)
3576 deallocate(linklist_head)
3577 linklist_head => current
3579 end subroutine pop_4d_2_arrays
3581 subroutine push_4d_3_arrays(a1, a2, a3, varname)
3585 real, dimension(:,:,:,:), intent(in) :: a1, a2, a3
3586 character(len=*), intent(in) :: varname
3588 type(linked_list), pointer :: current
3591 integer, dimension(3) :: len
3592 integer, dimension(0:3) :: num
3600 num(n) = num(n-1) + len(n)
3603 if(.not. associated(linklist_head)) then
3604 nullify(linklist_head)
3606 allocate(linklist_head)
3607 allocate(linklist_head%value(num(3)))
3608 nullify(linklist_head%next)
3610 linklist_head%id = 1
3611 linklist_head%name = varname
3612 call backup_array(linklist_head%value(num(0)+1:num(1)), a1, len(1))
3613 call backup_array(linklist_head%value(num(1)+1:num(2)), a2, len(2))
3614 call backup_array(linklist_head%value(num(2)+1:num(3)), a3, len(3))
3616 linklist_tail => linklist_head
3619 allocate(current%value(num(3)))
3620 nullify(current%next)
3621 current%id = linklist_head%id + 1
3622 current%name = varname
3623 call backup_array(current%value(num(0)+1:num(1)), a1, len(1))
3624 call backup_array(current%value(num(1)+1:num(2)), a2, len(2))
3625 call backup_array(current%value(num(2)+1:num(3)), a3, len(3))
3626 current%next => linklist_head
3627 linklist_head => current
3630 ! write(unit=*, fmt='(a,i4,3a)') &
3631 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
3633 end subroutine push_4d_3_arrays
3635 subroutine pop_4d_3_arrays(a1, a2, a3, varname)
3639 real, dimension(:,:,:,:), intent(out) :: a1, a2, a3
3640 character(len=*), intent(in) :: varname
3642 type(linked_list), pointer :: current
3645 integer, dimension(3) :: len
3646 integer, dimension(0:3) :: num
3654 num(n) = num(n-1) + len(n)
3657 current => linklist_head
3659 if(trim(current%name) /= trim(varname)) then
3660 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
3661 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
3665 ! write(unit=*, fmt='(a,i4,3a)') &
3666 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
3668 call restore_array(a1, current%value(num(0)+1:num(1)), len(1))
3669 call restore_array(a2, current%value(num(1)+1:num(2)), len(2))
3670 call restore_array(a3, current%value(num(2)+1:num(3)), len(3))
3672 current => current%next
3674 nullify(linklist_head%next)
3675 deallocate(linklist_head%value)
3676 deallocate(linklist_head)
3677 linklist_head => current
3679 end subroutine pop_4d_3_arrays
3681 subroutine push_4d_4_arrays(a1, a2, a3, a4, varname)
3685 real, dimension(:,:,:,:), intent(in) :: a1, a2, a3, a4
3686 character(len=*), intent(in) :: varname
3688 type(linked_list), pointer :: current
3691 integer, dimension(4) :: len
3692 integer, dimension(0:4) :: num
3701 num(n) = num(n-1) + len(n)
3704 if(.not. associated(linklist_head)) then
3705 nullify(linklist_head)
3707 allocate(linklist_head)
3708 allocate(linklist_head%value(num(4)))
3709 nullify(linklist_head%next)
3711 linklist_head%id = 1
3712 linklist_head%name = varname
3713 call backup_array(linklist_head%value(num(0)+1:num(1)), a1, len(1))
3714 call backup_array(linklist_head%value(num(1)+1:num(2)), a2, len(2))
3715 call backup_array(linklist_head%value(num(2)+1:num(3)), a3, len(3))
3716 call backup_array(linklist_head%value(num(3)+1:num(4)), a4, len(4))
3718 linklist_tail => linklist_head
3721 allocate(current%value(num(4)))
3722 nullify(current%next)
3723 current%id = linklist_head%id + 1
3724 current%name = varname
3725 call backup_array(current%value(num(0)+1:num(1)), a1, len(1))
3726 call backup_array(current%value(num(1)+1:num(2)), a2, len(2))
3727 call backup_array(current%value(num(2)+1:num(3)), a3, len(3))
3728 call backup_array(current%value(num(3)+1:num(4)), a4, len(4))
3729 current%next => linklist_head
3730 linklist_head => current
3733 ! write(unit=*, fmt='(a,i4,3a)') &
3734 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
3736 end subroutine push_4d_4_arrays
3738 subroutine pop_4d_4_arrays(a1, a2, a3, a4, varname)
3742 real, dimension(:,:,:,:), intent(out) :: a1, a2, a3, a4
3743 character(len=*), intent(in) :: varname
3745 type(linked_list), pointer :: current
3748 integer, dimension(4) :: len
3749 integer, dimension(0:4) :: num
3758 num(n) = num(n-1) + len(n)
3761 current => linklist_head
3763 if(trim(current%name) /= trim(varname)) then
3764 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
3765 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
3769 ! write(unit=*, fmt='(a,i4,3a)') &
3770 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
3772 call restore_array(a1, current%value(num(0)+1:num(1)), len(1))
3773 call restore_array(a2, current%value(num(1)+1:num(2)), len(2))
3774 call restore_array(a3, current%value(num(2)+1:num(3)), len(3))
3775 call restore_array(a4, current%value(num(3)+1:num(4)), len(4))
3777 current => current%next
3779 nullify(linklist_head%next)
3780 deallocate(linklist_head%value)
3781 deallocate(linklist_head)
3782 linklist_head => current
3784 end subroutine pop_4d_4_arrays
3786 subroutine push_4d_5_arrays(a1, a2, a3, a4, a5, varname)
3790 real, dimension(:,:,:,:), intent(in) :: a1, a2, a3, a4, a5
3791 character(len=*), intent(in) :: varname
3793 type(linked_list), pointer :: current
3796 integer, dimension(5) :: len
3797 integer, dimension(0:5) :: num
3807 num(n) = num(n-1) + len(n)
3810 if(.not. associated(linklist_head)) then
3811 nullify(linklist_head)
3813 allocate(linklist_head)
3814 allocate(linklist_head%value(num(5)))
3815 nullify(linklist_head%next)
3817 linklist_head%id = 1
3818 linklist_head%name = varname
3819 call backup_array(linklist_head%value(num(0)+1:num(1)), a1, len(1))
3820 call backup_array(linklist_head%value(num(1)+1:num(2)), a2, len(2))
3821 call backup_array(linklist_head%value(num(2)+1:num(3)), a3, len(3))
3822 call backup_array(linklist_head%value(num(3)+1:num(4)), a4, len(4))
3823 call backup_array(linklist_head%value(num(4)+1:num(5)), a5, len(5))
3825 linklist_tail => linklist_head
3828 allocate(current%value(num(5)))
3829 nullify(current%next)
3830 current%id = linklist_head%id + 1
3831 current%name = varname
3832 call backup_array(current%value(num(0)+1:num(1)), a1, len(1))
3833 call backup_array(current%value(num(1)+1:num(2)), a2, len(2))
3834 call backup_array(current%value(num(2)+1:num(3)), a3, len(3))
3835 call backup_array(current%value(num(3)+1:num(4)), a4, len(4))
3836 call backup_array(current%value(num(4)+1:num(5)), a5, len(5))
3837 current%next => linklist_head
3838 linklist_head => current
3841 ! write(unit=*, fmt='(a,i4,3a)') &
3842 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
3844 end subroutine push_4d_5_arrays
3846 subroutine pop_4d_5_arrays(a1, a2, a3, a4, a5, varname)
3850 real, dimension(:,:,:,:), intent(out) :: a1, a2, a3, a4, a5
3851 character(len=*), intent(in) :: varname
3853 type(linked_list), pointer :: current
3856 integer, dimension(5) :: len
3857 integer, dimension(0:5) :: num
3867 num(n) = num(n-1) + len(n)
3870 current => linklist_head
3872 if(trim(current%name) /= trim(varname)) then
3873 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
3874 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
3878 ! write(unit=*, fmt='(a,i4,3a)') &
3879 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
3881 call restore_array(a1, current%value(num(0)+1:num(1)), len(1))
3882 call restore_array(a2, current%value(num(1)+1:num(2)), len(2))
3883 call restore_array(a3, current%value(num(2)+1:num(3)), len(3))
3884 call restore_array(a4, current%value(num(3)+1:num(4)), len(4))
3885 call restore_array(a5, current%value(num(4)+1:num(5)), len(5))
3887 current => current%next
3889 nullify(linklist_head%next)
3890 deallocate(linklist_head%value)
3891 deallocate(linklist_head)
3892 linklist_head => current
3894 end subroutine pop_4d_5_arrays
3896 subroutine push_4d_6_arrays(a1, a2, a3, a4, a5, a6, varname)
3900 real, dimension(:,:,:,:), intent(in) :: a1, a2, a3, a4, a5, a6
3901 character(len=*), intent(in) :: varname
3903 type(linked_list), pointer :: current
3906 integer, dimension(6) :: len
3907 integer, dimension(0:6) :: num
3918 num(n) = num(n-1) + len(n)
3921 if(.not. associated(linklist_head)) then
3922 nullify(linklist_head)
3924 allocate(linklist_head)
3925 allocate(linklist_head%value(num(6)))
3926 nullify(linklist_head%next)
3928 linklist_head%id = 1
3929 linklist_head%name = varname
3930 call backup_array(linklist_head%value(num(0)+1:num(1)), a1, len(1))
3931 call backup_array(linklist_head%value(num(1)+1:num(2)), a2, len(2))
3932 call backup_array(linklist_head%value(num(2)+1:num(3)), a3, len(3))
3933 call backup_array(linklist_head%value(num(3)+1:num(4)), a4, len(4))
3934 call backup_array(linklist_head%value(num(4)+1:num(5)), a5, len(5))
3935 call backup_array(linklist_head%value(num(5)+1:num(6)), a6, len(6))
3937 linklist_tail => linklist_head
3940 allocate(current%value(num(6)))
3941 nullify(current%next)
3942 current%id = linklist_head%id + 1
3943 current%name = varname
3944 call backup_array(current%value(num(0)+1:num(1)), a1, len(1))
3945 call backup_array(current%value(num(1)+1:num(2)), a2, len(2))
3946 call backup_array(current%value(num(2)+1:num(3)), a3, len(3))
3947 call backup_array(current%value(num(3)+1:num(4)), a4, len(4))
3948 call backup_array(current%value(num(4)+1:num(5)), a5, len(5))
3949 call backup_array(current%value(num(5)+1:num(6)), a6, len(6))
3950 current%next => linklist_head
3951 linklist_head => current
3954 ! write(unit=*, fmt='(a,i4,3a)') &
3955 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
3957 end subroutine push_4d_6_arrays
3959 subroutine pop_4d_6_arrays(a1, a2, a3, a4, a5, a6, varname)
3963 real, dimension(:,:,:,:), intent(out) :: a1, a2, a3, a4, a5, a6
3964 character(len=*), intent(in) :: varname
3966 type(linked_list), pointer :: current
3969 integer, dimension(6) :: len
3970 integer, dimension(0:6) :: num
3981 num(n) = num(n-1) + len(n)
3984 current => linklist_head
3986 if(trim(current%name) /= trim(varname)) then
3987 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
3988 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
3992 ! write(unit=*, fmt='(a,i4,3a)') &
3993 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
3995 call restore_array(a1, current%value(num(0)+1:num(1)), len(1))
3996 call restore_array(a2, current%value(num(1)+1:num(2)), len(2))
3997 call restore_array(a3, current%value(num(2)+1:num(3)), len(3))
3998 call restore_array(a4, current%value(num(3)+1:num(4)), len(4))
3999 call restore_array(a5, current%value(num(4)+1:num(5)), len(5))
4000 call restore_array(a6, current%value(num(5)+1:num(6)), len(6))
4002 current => current%next
4004 nullify(linklist_head%next)
4005 deallocate(linklist_head%value)
4006 deallocate(linklist_head)
4007 linklist_head => current
4009 end subroutine pop_4d_6_arrays
4011 subroutine push_4d_7_arrays(a1, a2, a3, a4, a5, a6, a7, varname)
4015 real, dimension(:,:,:,:), intent(in) :: a1, a2, a3, a4, a5, a6, a7
4016 character(len=*), intent(in) :: varname
4018 type(linked_list), pointer :: current
4021 integer, dimension(7) :: len
4022 integer, dimension(0:7) :: num
4034 num(n) = num(n-1) + len(n)
4037 if(.not. associated(linklist_head)) then
4038 nullify(linklist_head)
4040 allocate(linklist_head)
4041 allocate(linklist_head%value(num(7)))
4042 nullify(linklist_head%next)
4044 linklist_head%id = 1
4045 linklist_head%name = varname
4046 call backup_array(linklist_head%value(num(0)+1:num(1)), a1, len(1))
4047 call backup_array(linklist_head%value(num(1)+1:num(2)), a2, len(2))
4048 call backup_array(linklist_head%value(num(2)+1:num(3)), a3, len(3))
4049 call backup_array(linklist_head%value(num(3)+1:num(4)), a4, len(4))
4050 call backup_array(linklist_head%value(num(4)+1:num(5)), a5, len(5))
4051 call backup_array(linklist_head%value(num(5)+1:num(6)), a6, len(6))
4052 call backup_array(linklist_head%value(num(6)+1:num(7)), a7, len(7))
4054 linklist_tail => linklist_head
4057 allocate(current%value(num(7)))
4058 nullify(current%next)
4059 current%id = linklist_head%id + 1
4060 current%name = varname
4061 call backup_array(current%value(num(0)+1:num(1)), a1, len(1))
4062 call backup_array(current%value(num(1)+1:num(2)), a2, len(2))
4063 call backup_array(current%value(num(2)+1:num(3)), a3, len(3))
4064 call backup_array(current%value(num(3)+1:num(4)), a4, len(4))
4065 call backup_array(current%value(num(4)+1:num(5)), a5, len(5))
4066 call backup_array(current%value(num(5)+1:num(6)), a6, len(6))
4067 call backup_array(current%value(num(6)+1:num(7)), a7, len(7))
4068 current%next => linklist_head
4069 linklist_head => current
4072 ! write(unit=*, fmt='(a,i4,3a)') &
4073 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
4075 end subroutine push_4d_7_arrays
4077 subroutine pop_4d_7_arrays(a1, a2, a3, a4, a5, a6, a7, varname)
4081 real, dimension(:,:,:,:), intent(out) :: a1, a2, a3, a4, a5, a6, a7
4082 character(len=*), intent(in) :: varname
4084 type(linked_list), pointer :: current
4087 integer, dimension(7) :: len
4088 integer, dimension(0:7) :: num
4100 num(n) = num(n-1) + len(n)
4103 current => linklist_head
4105 if(trim(current%name) /= trim(varname)) then
4106 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
4107 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
4111 ! write(unit=*, fmt='(a,i4,3a)') &
4112 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
4114 call restore_array(a1, current%value(num(0)+1:num(1)), len(1))
4115 call restore_array(a2, current%value(num(1)+1:num(2)), len(2))
4116 call restore_array(a3, current%value(num(2)+1:num(3)), len(3))
4117 call restore_array(a4, current%value(num(3)+1:num(4)), len(4))
4118 call restore_array(a5, current%value(num(4)+1:num(5)), len(5))
4119 call restore_array(a6, current%value(num(5)+1:num(6)), len(6))
4120 call restore_array(a7, current%value(num(6)+1:num(7)), len(7))
4122 current => current%next
4124 nullify(linklist_head%next)
4125 deallocate(linklist_head%value)
4126 deallocate(linklist_head)
4127 linklist_head => current
4129 end subroutine pop_4d_7_arrays
4131 subroutine push_4d_8_arrays(a1, a2, a3, a4, a5, a6, a7, a8, varname)
4135 real, dimension(:,:,:,:), intent(in) :: a1, a2, a3, a4, a5, a6, a7, a8
4136 character(len=*), intent(in) :: varname
4138 type(linked_list), pointer :: current
4141 integer, dimension(8) :: len
4142 integer, dimension(0:8) :: num
4155 num(n) = num(n-1) + len(n)
4158 if(.not. associated(linklist_head)) then
4159 nullify(linklist_head)
4161 allocate(linklist_head)
4162 allocate(linklist_head%value(num(8)))
4163 nullify(linklist_head%next)
4165 linklist_head%id = 1
4166 linklist_head%name = varname
4167 call backup_array(linklist_head%value(num(0)+1:num(1)), a1, len(1))
4168 call backup_array(linklist_head%value(num(1)+1:num(2)), a2, len(2))
4169 call backup_array(linklist_head%value(num(2)+1:num(3)), a3, len(3))
4170 call backup_array(linklist_head%value(num(3)+1:num(4)), a4, len(4))
4171 call backup_array(linklist_head%value(num(4)+1:num(5)), a5, len(5))
4172 call backup_array(linklist_head%value(num(5)+1:num(6)), a6, len(6))
4173 call backup_array(linklist_head%value(num(6)+1:num(7)), a7, len(7))
4174 call backup_array(linklist_head%value(num(7)+1:num(8)), a8, len(8))
4176 linklist_tail => linklist_head
4179 allocate(current%value(num(8)))
4180 nullify(current%next)
4181 current%id = linklist_head%id + 1
4182 current%name = varname
4183 call backup_array(current%value(num(0)+1:num(1)), a1, len(1))
4184 call backup_array(current%value(num(1)+1:num(2)), a2, len(2))
4185 call backup_array(current%value(num(2)+1:num(3)), a3, len(3))
4186 call backup_array(current%value(num(3)+1:num(4)), a4, len(4))
4187 call backup_array(current%value(num(4)+1:num(5)), a5, len(5))
4188 call backup_array(current%value(num(5)+1:num(6)), a6, len(6))
4189 call backup_array(current%value(num(6)+1:num(7)), a7, len(7))
4190 call backup_array(current%value(num(7)+1:num(8)), a8, len(8))
4191 current%next => linklist_head
4192 linklist_head => current
4195 ! write(unit=*, fmt='(a,i4,3a)') &
4196 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
4198 end subroutine push_4d_8_arrays
4200 subroutine pop_4d_8_arrays(a1, a2, a3, a4, a5, a6, a7, a8, varname)
4204 real, dimension(:,:,:,:), intent(out) :: a1, a2, a3, a4, a5, a6, a7, a8
4205 character(len=*), intent(in) :: varname
4207 type(linked_list), pointer :: current
4210 integer, dimension(8) :: len
4211 integer, dimension(0:8) :: num
4224 num(n) = num(n-1) + len(n)
4227 current => linklist_head
4229 if(trim(current%name) /= trim(varname)) then
4230 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
4231 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
4235 ! write(unit=*, fmt='(a,i4,3a)') &
4236 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
4238 call restore_array(a1, current%value(num(0)+1:num(1)), len(1))
4239 call restore_array(a2, current%value(num(1)+1:num(2)), len(2))
4240 call restore_array(a3, current%value(num(2)+1:num(3)), len(3))
4241 call restore_array(a4, current%value(num(3)+1:num(4)), len(4))
4242 call restore_array(a5, current%value(num(4)+1:num(5)), len(5))
4243 call restore_array(a6, current%value(num(5)+1:num(6)), len(6))
4244 call restore_array(a7, current%value(num(6)+1:num(7)), len(7))
4245 call restore_array(a8, current%value(num(7)+1:num(8)), len(8))
4247 current => current%next
4249 nullify(linklist_head%next)
4250 deallocate(linklist_head%value)
4251 deallocate(linklist_head)
4252 linklist_head => current
4254 end subroutine pop_4d_8_arrays
4256 subroutine push_4d_9_arrays(a1, a2, a3, a4, a5, a6, a7, a8, a9, varname)
4260 real, dimension(:,:,:,:), intent(in) :: a1, a2, a3, a4, a5, a6, a7, a8, a9
4261 character(len=*), intent(in) :: varname
4263 type(linked_list), pointer :: current
4266 integer, dimension(9) :: len
4267 integer, dimension(0:9) :: num
4281 num(n) = num(n-1) + len(n)
4284 if(.not. associated(linklist_head)) then
4285 nullify(linklist_head)
4287 allocate(linklist_head)
4288 allocate(linklist_head%value(num(9)))
4289 nullify(linklist_head%next)
4291 linklist_head%id = 1
4292 linklist_head%name = varname
4293 call backup_array(linklist_head%value(num(0)+1:num(1)), a1, len(1))
4294 call backup_array(linklist_head%value(num(1)+1:num(2)), a2, len(2))
4295 call backup_array(linklist_head%value(num(2)+1:num(3)), a3, len(3))
4296 call backup_array(linklist_head%value(num(3)+1:num(4)), a4, len(4))
4297 call backup_array(linklist_head%value(num(4)+1:num(5)), a5, len(5))
4298 call backup_array(linklist_head%value(num(5)+1:num(6)), a6, len(6))
4299 call backup_array(linklist_head%value(num(6)+1:num(7)), a7, len(7))
4300 call backup_array(linklist_head%value(num(7)+1:num(8)), a8, len(8))
4301 call backup_array(linklist_head%value(num(8)+1:num(9)), a9, len(9))
4303 linklist_tail => linklist_head
4306 allocate(current%value(num(9)))
4307 nullify(current%next)
4308 current%id = linklist_head%id + 1
4309 current%name = varname
4310 call backup_array(current%value(num(0)+1:num(1)), a1, len(1))
4311 call backup_array(current%value(num(1)+1:num(2)), a2, len(2))
4312 call backup_array(current%value(num(2)+1:num(3)), a3, len(3))
4313 call backup_array(current%value(num(3)+1:num(4)), a4, len(4))
4314 call backup_array(current%value(num(4)+1:num(5)), a5, len(5))
4315 call backup_array(current%value(num(5)+1:num(6)), a6, len(6))
4316 call backup_array(current%value(num(6)+1:num(7)), a7, len(7))
4317 call backup_array(current%value(num(7)+1:num(8)), a8, len(8))
4318 call backup_array(current%value(num(8)+1:num(9)), a9, len(9))
4319 current%next => linklist_head
4320 linklist_head => current
4323 ! write(unit=*, fmt='(a,i4,3a)') &
4324 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
4326 end subroutine push_4d_9_arrays
4328 subroutine pop_4d_9_arrays(a1, a2, a3, a4, a5, a6, a7, a8, a9, varname)
4332 real, dimension(:,:,:,:), intent(out) :: a1, a2, a3, a4, a5, a6, a7, a8, a9
4333 character(len=*), intent(in) :: varname
4335 type(linked_list), pointer :: current
4338 integer, dimension(9) :: len
4339 integer, dimension(0:9) :: num
4353 num(n) = num(n-1) + len(n)
4356 current => linklist_head
4358 if(trim(current%name) /= trim(varname)) then
4359 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
4360 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
4364 ! write(unit=*, fmt='(a,i4,3a)') &
4365 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
4367 call restore_array(a1, current%value(num(0)+1:num(1)), len(1))
4368 call restore_array(a2, current%value(num(1)+1:num(2)), len(2))
4369 call restore_array(a3, current%value(num(2)+1:num(3)), len(3))
4370 call restore_array(a4, current%value(num(3)+1:num(4)), len(4))
4371 call restore_array(a5, current%value(num(4)+1:num(5)), len(5))
4372 call restore_array(a6, current%value(num(5)+1:num(6)), len(6))
4373 call restore_array(a7, current%value(num(6)+1:num(7)), len(7))
4374 call restore_array(a8, current%value(num(7)+1:num(8)), len(8))
4375 call restore_array(a9, current%value(num(8)+1:num(9)), len(9))
4377 current => current%next
4379 nullify(linklist_head%next)
4380 deallocate(linklist_head%value)
4381 deallocate(linklist_head)
4382 linklist_head => current
4384 end subroutine pop_4d_9_arrays
4386 subroutine push_4d_10_arrays(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, varname)
4390 real, dimension(:,:,:,:), intent(in) :: a1, a2, a3, a4, a5, a6, a7, a8, a9, a10
4391 character(len=*), intent(in) :: varname
4393 type(linked_list), pointer :: current
4396 integer, dimension(10) :: len
4397 integer, dimension(0:10) :: num
4412 num(n) = num(n-1) + len(n)
4415 if(.not. associated(linklist_head)) then
4416 nullify(linklist_head)
4418 allocate(linklist_head)
4419 allocate(linklist_head%value(num(10)))
4420 nullify(linklist_head%next)
4422 linklist_head%id = 1
4423 linklist_head%name = varname
4424 call backup_array(linklist_head%value(num(0)+1:num(1)), a1, len(1))
4425 call backup_array(linklist_head%value(num(1)+1:num(2)), a2, len(2))
4426 call backup_array(linklist_head%value(num(2)+1:num(3)), a3, len(3))
4427 call backup_array(linklist_head%value(num(3)+1:num(4)), a4, len(4))
4428 call backup_array(linklist_head%value(num(4)+1:num(5)), a5, len(5))
4429 call backup_array(linklist_head%value(num(5)+1:num(6)), a6, len(6))
4430 call backup_array(linklist_head%value(num(6)+1:num(7)), a7, len(7))
4431 call backup_array(linklist_head%value(num(7)+1:num(8)), a8, len(8))
4432 call backup_array(linklist_head%value(num(8)+1:num(9)), a9, len(9))
4433 call backup_array(linklist_head%value(num(9)+1:num(10)), a10, len(10))
4435 linklist_tail => linklist_head
4438 allocate(current%value(num(10)))
4439 nullify(current%next)
4440 current%id = linklist_head%id + 1
4441 current%name = varname
4442 call backup_array(current%value(num(0)+1:num(1)), a1, len(1))
4443 call backup_array(current%value(num(1)+1:num(2)), a2, len(2))
4444 call backup_array(current%value(num(2)+1:num(3)), a3, len(3))
4445 call backup_array(current%value(num(3)+1:num(4)), a4, len(4))
4446 call backup_array(current%value(num(4)+1:num(5)), a5, len(5))
4447 call backup_array(current%value(num(5)+1:num(6)), a6, len(6))
4448 call backup_array(current%value(num(6)+1:num(7)), a7, len(7))
4449 call backup_array(current%value(num(7)+1:num(8)), a8, len(8))
4450 call backup_array(current%value(num(8)+1:num(9)), a9, len(9))
4451 call backup_array(current%value(num(9)+1:num(10)), a10, len(10))
4452 current%next => linklist_head
4453 linklist_head => current
4456 ! write(unit=*, fmt='(a,i4,3a)') &
4457 ! 'Push id:', current%id, ', name: <', trim(current%name), '>'
4459 end subroutine push_4d_10_arrays
4461 subroutine pop_4d_10_arrays(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, varname)
4465 real, dimension(:,:,:,:), intent(out) :: a1, a2, a3, a4, a5, a6, a7, a8, a9, a10
4466 character(len=*), intent(in) :: varname
4468 type(linked_list), pointer :: current
4471 integer, dimension(10) :: len
4472 integer, dimension(0:10) :: num
4487 num(n) = num(n-1) + len(n)
4490 current => linklist_head
4492 if(trim(current%name) /= trim(varname)) then
4493 write(unit=6, fmt='(3a)') "Want var: <", trim(varname), ">"
4494 write(unit=6, fmt='(3a)') "But first var in list is: <", trim(current%name), ">"
4498 ! write(unit=*, fmt='(a,i4,3a)') &
4499 ! 'Pop id:', current%id, ', name: <', trim(current%name), '>'
4501 call restore_array(a1, current%value(num(0)+1:num(1)), len(1))
4502 call restore_array(a2, current%value(num(1)+1:num(2)), len(2))
4503 call restore_array(a3, current%value(num(2)+1:num(3)), len(3))
4504 call restore_array(a4, current%value(num(3)+1:num(4)), len(4))
4505 call restore_array(a5, current%value(num(4)+1:num(5)), len(5))
4506 call restore_array(a6, current%value(num(5)+1:num(6)), len(6))
4507 call restore_array(a7, current%value(num(6)+1:num(7)), len(7))
4508 call restore_array(a8, current%value(num(7)+1:num(8)), len(8))
4509 call restore_array(a9, current%value(num(8)+1:num(9)), len(9))
4510 call restore_array(a10, current%value(num(9)+1:num(10)), len(10))
4512 current => current%next
4514 nullify(linklist_head%next)
4515 deallocate(linklist_head%value)
4516 deallocate(linklist_head)
4517 linklist_head => current
4519 end subroutine pop_4d_10_arrays
4521 subroutine backup_1d_array(vout, vin, len)
4523 integer, intent(in) :: len
4524 real, dimension(:), intent(in ) :: vin
4525 real, dimension(:), intent(out) :: vout
4527 vout(1:len) = vin(1:len)
4528 end subroutine backup_1d_array
4530 subroutine backup_2d_array(vout, vin, len)
4532 integer, intent(in) :: len
4533 real, dimension(:), intent(out) :: vout
4534 real, dimension(:,:), intent(in ) :: vin
4535 integer :: n1, n2, i, j, n
4536 n1 = size(vin, dim=1)
4537 n2 = size(vin, dim=2)
4541 vout(n+i) = vin(i,j)
4544 end subroutine backup_2d_array
4546 subroutine backup_3d_array(vout, vin, len)
4548 integer, intent(in) :: len
4549 real, dimension(:), intent(out) :: vout
4550 real, dimension(:,:,:), intent(in ) :: vin
4551 integer :: n1, n2, n3, i, j, k, n
4552 n1 = size(vin, dim=1)
4553 n2 = size(vin, dim=2)
4554 n3 = size(vin, dim=3)
4557 n = n1*(j-1 + n2*(k-1))
4559 vout(n+i) = vin(i,j,k)
4563 end subroutine backup_3d_array
4565 subroutine backup_4d_array(vout, vin, len)
4567 integer, intent(in) :: len
4568 real, dimension(:), intent(out) :: vout
4569 real, dimension(:,:,:,:), intent(in ) :: vin
4570 integer :: n1, n2, n3, n4, i, j, k, m, n
4571 n1 = size(vin, dim=1)
4572 n2 = size(vin, dim=2)
4573 n3 = size(vin, dim=3)
4574 n4 = size(vin, dim=4)
4578 n = n1*(j-1 + n2*(k-1 + n3*(m-1)))
4580 vout(n+i) = vin(i,j,k,m)
4585 end subroutine backup_4d_array
4587 subroutine restore_1d_array(vout, vin, len)
4589 integer, intent(in) :: len
4590 real, dimension(:), intent(in ) :: vin
4591 real, dimension(:), intent(out) :: vout
4593 vout(1:len) = vin(1:len)
4594 end subroutine restore_1d_array
4596 subroutine restore_2d_array(vout, vin, len)
4598 integer, intent(in) :: len
4599 real, dimension(:,:), intent(out) :: vout
4600 real, dimension(:), intent(in ) :: vin
4601 integer :: n1, n2, i, j, n
4602 n1 = size(vout, dim=1)
4603 n2 = size(vout, dim=2)
4607 vout(i,j) = vin(n+i)
4610 end subroutine restore_2d_array
4612 subroutine restore_3d_array(vout, vin, len)
4614 integer, intent(in) :: len
4615 real, dimension(:,:,:), intent(out) :: vout
4616 real, dimension(:), intent(in ) :: vin
4617 integer :: n1, n2, n3, i, j, k, n
4618 n1 = size(vout, dim=1)
4619 n2 = size(vout, dim=2)
4620 n3 = size(vout, dim=3)
4623 n = n1*(j-1 + n2*(k-1))
4625 vout(i,j,k) = vin(n+i)
4629 end subroutine restore_3d_array
4631 subroutine restore_4d_array(vout, vin, len)
4633 integer, intent(in) :: len
4634 real, dimension(:,:,:,:), intent(out) :: vout
4635 real, dimension(:), intent(in ) :: vin
4636 integer :: n1, n2, n3, n4, i, j, k, m, n
4637 n1 = size(vout, dim=1)
4638 n2 = size(vout, dim=2)
4639 n3 = size(vout, dim=3)
4640 n4 = size(vout, dim=4)
4644 n = n1*(j-1 + n2*(k-1 + n3*(m-1)))
4646 vout(i,j,k,m) = vin(n+i)
4651 end subroutine restore_4d_array
4653 end module module_linked_list2