add_position Subroutine

private subroutine add_position(self, pos, ok)

Add a position (the first dof elements of pos are used) for the next time that has none. ok is false if every time already has a position.

Type Bound

Trajectory

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(inout) :: self
real(kind=wp), intent(in) :: pos(:)

position (first dof elements used)

logical, intent(out), optional :: ok

false if not added


Calls

proc~~add_position~~CallsGraph proc~add_position Trajectory%add_position proc~grow_positions grow_positions proc~add_position->proc~grow_positions proc~new_capacity new_capacity proc~grow_positions->proc~new_capacity

Called by

proc~~add_position~~CalledByGraph proc~add_position Trajectory%add_position proc~add_point Trajectory%add_point proc~add_point->proc~add_position

Source Code

    subroutine add_position(self, pos, ok)
        class(Trajectory), intent(inout) :: self
        real(wp), intent(in) :: pos(:)          !! position (first [[dof]] elements used)
        logical, intent(out), optional :: ok    !! false if not added
        integer :: d
        if (present(ok)) ok = .false.
        if (self%n_pos >= self%n_times) return
        call grow_positions(self, self%n_pos + 1)
        self%n_pos = self%n_pos + 1
        d = min(self%dof_, size(pos))
        self%posopt(:, :, self%n_pos) = 0.0_wp
        self%posopt(1:d, 0, self%n_pos) = pos(1:d)
        self%revision_ = self%revision_ + 1
        if (present(ok)) ok = .true.
    end subroutine add_position