set_optional Subroutine

private subroutine set_optional(self, index, v, ok)

Set optional vector index (1 to num_optionals) of the most recently added position. ok is false if there is no position or no such optional.

Type Bound

Trajectory

Arguments

Type IntentOptional Attributes Name
class(Trajectory), intent(inout) :: self
integer, intent(in) :: index

the optional (1 to num_optionals)

real(kind=wp), intent(in) :: v(:)

the vector (its first dof elements are used)

logical, intent(out), optional :: ok

false if not set


Source Code

    subroutine set_optional(self, index, v, ok)
        class(Trajectory), intent(inout) :: self
        integer, intent(in) :: index            !! the optional (1 to num_optionals)
        real(wp), intent(in) :: v(:)            !! the vector (its first [[dof]] elements are used)
        logical, intent(out), optional :: ok    !! false if not set
        integer :: d
        if (present(ok)) ok = .false.
        if (index < 1 .or. index > self%nopt_ .or. self%n_pos == 0) return
        d = min(self%dof_, size(v))
        self%posopt(1:d, index, self%n_pos) = v(1:d)
        self%revision_ = self%revision_ + 1
        if (present(ok)) ok = .true.
    end subroutine set_optional