The JSON object of a segment's trajectory (for export_trajectory_json_file),
replacing the contents of buf.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(segment), | intent(in) | :: | seg | |||
| integer, | intent(in) | :: | iseg |
segment number |
||
| logical, | intent(in) | :: | last |
if this is the last segment (no comma after it) |
||
| type(text_buffer), | intent(inout) | :: | buf |
subroutine segment_trajectory_json(seg, iseg, last, buf) implicit none type(segment),intent(in) :: seg integer,intent(in) :: iseg !! segment number logical,intent(in) :: last !! if this is the last segment (no comma after it) type(text_buffer),intent(inout) :: buf character(len=*),parameter :: nl = new_line('a') call buf%clear() call buf%add_str(' {'//nl//' "iseg": ') call buf%add_int(iseg) call add_array('et', seg%traj_inertial%et) call add_array('x_inertial', seg%traj_inertial%x) call add_array('y_inertial', seg%traj_inertial%y) call add_array('z_inertial', seg%traj_inertial%z) call add_array('vx_inertial', seg%traj_inertial%vx) call add_array('vy_inertial', seg%traj_inertial%vy) call add_array('vz_inertial', seg%traj_inertial%vz) call add_array('x_rotating', seg%traj_rotating%x) call add_array('y_rotating', seg%traj_rotating%y) call add_array('z_rotating', seg%traj_rotating%z) call add_array('x_se_rotating', seg%traj_se_rotating%x) call add_array('y_se_rotating', seg%traj_se_rotating%y) call add_array('z_se_rotating', seg%traj_se_rotating%z) if (last) then call buf%add_str(nl//' }'//nl) else call buf%add_str(nl//' },'//nl) end if contains subroutine add_array(name, x) character(len=*),intent(in) :: name real(wp),dimension(:),intent(in) :: x call buf%add_str(','//nl//' "'//name//'": ') call buf%add_real_array(x) end subroutine add_array end subroutine segment_trajectory_json