Reserve memory for n points: times, positions (with their optionals)
unless positions is false, and attitudes and colors only if
attitudes / colors is true. Optional: storage grows as needed, but
reserving avoids reallocations for a known size. It never shrinks the
storage (see compact).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Trajectory), | intent(inout) | :: | self | |||
| integer, | intent(in) | :: | n |
number of points |
||
| logical, | intent(in), | optional | :: | positions |
reserve positions (default true) |
|
| logical, | intent(in), | optional | :: | attitudes |
reserve attitudes (default false) |
|
| logical, | intent(in), | optional | :: | colors |
reserve colors (default false) |
subroutine reserve(self, n, positions, attitudes, colors) class(Trajectory), intent(inout) :: self integer, intent(in) :: n !! number of points logical, intent(in), optional :: positions !! reserve positions (default true) logical, intent(in), optional :: attitudes !! reserve attitudes (default false) logical, intent(in), optional :: colors !! reserve colors (default false) logical :: pos, att, col pos = .true. att = .false. col = .false. if (present(positions)) pos = positions if (present(attitudes)) att = attitudes if (present(colors)) col = colors call grow_times(self, n, exact=.true.) if (pos) call grow_positions(self, n, exact=.true.) if (att) call grow_attitudes(self, n, exact=.true.) if (col) call grow_colors(self, n, exact=.true.) end subroutine reserve