Get the arrays for the problem
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(mission_type), | intent(in) | :: | me | |||
real(kind=wp), | intent(out), | optional, | dimension(:) | :: | x |
opt var vector [scaled] |
real(kind=wp), | intent(out), | optional, | dimension(:) | :: | f |
constraint violations |
subroutine get_problem_arrays(me,x,f) implicit none class(mission_type),intent(in) :: me real(wp),dimension(:),intent(out),optional :: x !! opt var vector [scaled] real(wp),dimension(:),intent(out),optional :: f !! constraint violations integer :: i !! counter for index in `x` integer :: irev !! counter for number of revs integer :: iseg !! segment number counter if (present(x)) then x = -huge(1.0_wp) ! just in case we miss one i = 0 ! initialize the index. will be updated by fill_vector iseg = 0 do irev = 1, me%n_revs if (irev==1) then ! the first one has an extra opt point at the initial periapsis passage if (.not. me%fix_initial_time) & call fill_vector(x, me%segs(iseg+1)%data%t0, i) if (me%fix_initial_r) then call fill_vector(x, me%segs(iseg+1)%data%x0_rotating(4:6), i) ! v only else call fill_vector(x, me%segs(iseg+1)%data%x0_rotating, i) ! r,v end if call fill_vector(x, me%segs(iseg+2)%data%t0, i) call fill_vector(x, me%segs(iseg+2)%data%x0_rotating, i) call fill_vector(x, me%segs(iseg+4)%data%t0, i) call fill_vector(x, me%segs(iseg+4)%data%x0_rotating, i) call fill_vector(x, me%segs(iseg+6)%data%t0, i) call fill_vector(x, me%segs(iseg+6)%data%x0_rotating, i) call fill_vector(x, me%segs(iseg+8)%data%t0, i) if (me%fix_ry_at_end_of_rev == 1) then call fill_vector(x, me%segs(iseg+8)%data%x0_rotating([1,3,4,5,6]), i) else call fill_vector(x, me%segs(iseg+8)%data%x0_rotating, i) end if ! for next rev: iseg = iseg + 8 else call fill_vector(x, me%segs(iseg+2)%data%t0, i) call fill_vector(x, me%segs(iseg+2)%data%x0_rotating, i) call fill_vector(x, me%segs(iseg+4)%data%t0, i) call fill_vector(x, me%segs(iseg+4)%data%x0_rotating, i) call fill_vector(x, me%segs(iseg+6)%data%t0, i) call fill_vector(x, me%segs(iseg+6)%data%x0_rotating, i) call fill_vector(x, me%segs(iseg+8)%data%t0, i) if (me%fix_ry_at_end_of_rev == irev) then call fill_vector(x, me%segs(iseg+8)%data%x0_rotating([1,3,4,5,6]), i) elseif (irev==me%n_revs .and. me%fix_final_ry_and_vx) then call fill_vector(x, me%segs(iseg+8)%data%x0_rotating([1,3,5,6]), i) else call fill_vector(x, me%segs(iseg+8)%data%x0_rotating, i) end if ! for next rev: iseg = iseg + 8 end if end do ! scale the x vector: x = x / me%xscale end if if (present(f)) then ! f = [xf1-xf2, xf3-xf4, xf5-xf6, xf7-xf8, ... ] i = 0 iseg = 0 do irev = 1, me%n_revs call fill_vector(f, -(me%segs(iseg+1)%data%xf_rotating - me%segs(iseg+2)%data%xf_rotating), i) call fill_vector(f, -(me%segs(iseg+3)%data%xf_rotating - me%segs(iseg+4)%data%xf_rotating), i) call fill_vector(f, -(me%segs(iseg+5)%data%xf_rotating - me%segs(iseg+6)%data%xf_rotating), i) call fill_vector(f, -(me%segs(iseg+7)%data%xf_rotating - me%segs(iseg+8)%data%xf_rotating), i) iseg = iseg + 8 end do !scale the f vector: f = f / me%fscale end if end subroutine get_problem_arrays