509 class(StructArrayType) :: this
510 integer(I4B), intent(in) :: icol
511 integer(I4B) :: i, j, isize
512 integer(I4B), dimension(:), pointer, contiguous :: p_int1d
513 integer(I4B), dimension(:, :), pointer, contiguous :: p_int2d
514 real(DP), dimension(:), pointer, contiguous :: p_dbl1d
515 real(DP), dimension(:, :), pointer, contiguous :: p_dbl2d
516 type(CharacterStringType), dimension(:), pointer, contiguous :: p_charstr1d
517 character(len=LENVARNAME) :: varname
518 logical(LGP) :: overwrite
519
520 overwrite = .true.
521 if (this%struct_vectors(icol)%idt%blockname == 'SOLUTIONGROUP') &
522 overwrite = .false.
523
524
525 varname = this%struct_vectors(icol)%idt%mf6varname
526
527 call get_isize(varname, this%mempath, isize)
528
529
530 select case (this%struct_vectors(icol)%memtype)
531 case (mtype_int)
532 if (isize > -1) then
533
534 call mem_setptr(p_int1d, varname, this%mempath)
535
536 if (overwrite) then
537
538 if (this%nrow > isize) then
539
541 end if
542
543
544 do i = 1, this%nrow
545 p_int1d(i) = this%struct_vectors(icol)%int1d(i)
546 end do
547
548 if (isize > this%nrow) then
549
550 do i = this%nrow + 1, isize
551 p_int1d(i) = izero
552 end do
553 end if
554 else
555
556 call mem_reallocate(p_int1d, this%nrow + isize, varname, this%mempath)
557
558
559 do i = 1, this%nrow
560 p_int1d(isize + i) = this%struct_vectors(icol)%int1d(i)
561 end do
562 end if
563 else
564
565 call mem_allocate(p_int1d, this%nrow, varname, this%mempath)
566
567
568 do i = 1, this%nrow
569 p_int1d(i) = this%struct_vectors(icol)%int1d(i)
570 end do
571 end if
572
573
574 deallocate (this%struct_vectors(icol)%int1d)
575
576
577 this%struct_vectors(icol)%int1d => p_int1d
578 this%struct_vectors(icol)%size = this%nrow
579 case (mtype_dbl)
580 if (isize > -1) then
581 call mem_setptr(p_dbl1d, varname, this%mempath)
582
583 if (overwrite) then
584 if (this%nrow > isize) then
586 end if
587
588 do i = 1, this%nrow
589 p_dbl1d(i) = this%struct_vectors(icol)%dbl1d(i)
590 end do
591
592 if (isize > this%nrow) then
593 do i = this%nrow + 1, isize
594 p_dbl1d(i) = dzero
595 end do
596 end if
597 else
599 this%mempath)
600 do i = 1, this%nrow
601 p_dbl1d(isize + i) = this%struct_vectors(icol)%dbl1d(i)
602 end do
603 end if
604 else
605 call mem_allocate(p_dbl1d, this%nrow, varname, this%mempath)
606
607 do i = 1, this%nrow
608 p_dbl1d(i) = this%struct_vectors(icol)%dbl1d(i)
609 end do
610 end if
611
612 deallocate (this%struct_vectors(icol)%dbl1d)
613
614 this%struct_vectors(icol)%dbl1d => p_dbl1d
615 this%struct_vectors(icol)%size = this%nrow
616
617 case (mtype_str)
618 if (isize > -1) then
619 call mem_setptr(p_charstr1d, varname, this%mempath)
620
621 if (overwrite) then
622 if (this%nrow > isize) then
623 call mem_reallocate(p_charstr1d, this%struct_vectors(icol)%charlen, &
624 this%nrow, varname, this%mempath)
625 end if
626
627 do i = 1, this%nrow
628 p_charstr1d(i) = this%struct_vectors(icol)%charstr1d(i)
629 end do
630
631 if (isize > this%nrow) then
632 do i = this%nrow + 1, isize
633 p_charstr1d(i) = ''
634 end do
635 end if
636 else
637 call mem_reallocate(p_charstr1d, this%struct_vectors(icol)%charlen, &
638 this%nrow + isize, varname, this%mempath)
639 do i = 1, this%nrow
640 p_charstr1d(isize + i) = this%struct_vectors(icol)%charstr1d(i)
641 end do
642 end if
643 else
644 call mem_allocate(p_charstr1d, this%struct_vectors(icol)%charlen, &
645 this%nrow, varname, this%mempath)
646 do i = 1, this%nrow
647 p_charstr1d(i) = this%struct_vectors(icol)%charstr1d(i)
648 call this%struct_vectors(icol)%charstr1d(i)%destroy()
649 end do
650 end if
651
652 deallocate (this%struct_vectors(icol)%charstr1d)
653
654 this%struct_vectors(icol)%charstr1d => p_charstr1d
655 this%struct_vectors(icol)%size = this%nrow
656 case (mtype_intvec)
657 errmsg = 'StructArray::load_deferred_vector &
658 &intvector reallocate unimplemented.'
659 call store_error(errmsg, terminate=.true.)
660 case (mtype_int2d)
661 if (isize > -1) then
662 errmsg = 'StructArray::load_deferred_vector &
663 &int2d reallocate unimplemented.'
664 call store_error(errmsg, terminate=.true.)
665 else
666 call mem_allocate(p_int2d, this%struct_vectors(icol)%intshape, &
667 this%nrow, varname, this%mempath)
668 do i = 1, this%nrow
669 do j = 1, this%struct_vectors(icol)%intshape
670 p_int2d(j, i) = this%struct_vectors(icol)%int2d(j, i)
671 end do
672 end do
673 end if
674
675 deallocate (this%struct_vectors(icol)%int2d)
676
677 this%struct_vectors(icol)%int2d => p_int2d
678 this%struct_vectors(icol)%size = this%nrow
679 case (mtype_dbl2d)
680 if (isize > -1) then
681 errmsg = 'StructArray::load_deferred_vector &
682 &dbl2d reallocate unimplemented.'
683 call store_error(errmsg, terminate=.true.)
684 else
685 call mem_allocate(p_dbl2d, this%struct_vectors(icol)%intshape, &
686 this%nrow, varname, this%mempath)
687 do i = 1, this%nrow
688 do j = 1, this%struct_vectors(icol)%intshape
689 p_dbl2d(j, i) = this%struct_vectors(icol)%dbl2d(j, i)
690 end do
691 end do
692 end if
693
694 deallocate (this%struct_vectors(icol)%dbl2d)
695
696 this%struct_vectors(icol)%dbl2d => p_dbl2d
697 this%struct_vectors(icol)%size = this%nrow
698 case default
699 end select