@@ -503,21 +503,21 @@ Sorting a rank 2 array based on the data in a column
503
503
Sorting an array of a derived type based on the data in one component
504
504
505
505
``` fortran
506
- subroutine sort_a_data( a_data, a, work, index, iwork )
507
- ! Sort `a_data` in terms or its component `a`
508
- type(a_type), intent(inout) :: a_data(:)
509
- integer(int32), intent(inout) :: a(:)
510
- integer(int32), intent(out) :: work(:)
511
- integer(int_size), intent(out) :: index(:)
512
- integer(int_size), intent(out) :: iwork(:)
513
- ! Extract a component of `a_data`
514
- a(1:size(a_data)) = a_data(:) % a
515
- ! Find the indices to sort the component
516
- call sort_index(a(1:size(a_data)), index(1:size(a_data)),&
517
- work(1:size(a_data)/2), iwork(1:size(a_data)/2))
518
- ! Sort a_data based on the sorting of that component
519
- a_data(:) = a_data( index(1:size(a_data)) )
520
- end subroutine sort_a_data
506
+ subroutine sort_a_data( a_data, a, work, index, iwork )
507
+ ! Sort `a_data` in terms or its component `a`
508
+ type(a_type), intent(inout) :: a_data(:)
509
+ integer(int32), intent(inout) :: a(:)
510
+ integer(int32), intent(out) :: work(:)
511
+ integer(int_size), intent(out) :: index(:)
512
+ integer(int_size), intent(out) :: iwork(:)
513
+ ! Extract a component of `a_data`
514
+ a(1:size(a_data)) = a_data(:) % a
515
+ ! Find the indices to sort the component
516
+ call sort_index(a(1:size(a_data)), index(1:size(a_data)),&
517
+ work(1:size(a_data)/2), iwork(1:size(a_data)/2))
518
+ ! Sort a_data based on the sorting of that component
519
+ a_data(:) = a_data( index(1:size(a_data)) )
520
+ end subroutine sort_a_data
521
521
```
522
522
523
523
0 commit comments