MODFLOW 6  version 6.5.0.dev2
MODFLOW 6 Code Documentation
sortmodule::unique_values Interface Reference
Collaboration diagram for sortmodule::unique_values:
Collaboration graph

Private Member Functions

subroutine unique_values_int1d (a, b)
 
subroutine unique_values_dbl1d (a, b)
 

Detailed Description

Definition at line 15 of file sort.f90.

Member Function/Subroutine Documentation

◆ unique_values_dbl1d()

subroutine sortmodule::unique_values::unique_values_dbl1d ( real(dp), dimension(:), intent(in), allocatable  a,
real(dp), dimension(:), intent(inout), allocatable  b 
)
private

Definition at line 345 of file sort.f90.

346  ! - dummy arguments
347  real(DP), dimension(:), allocatable, intent(in) :: a
348  real(DP), dimension(:), allocatable, intent(inout) :: b
349  ! -- local variables
350  integer(I4B) :: count
351  integer(I4B) :: n
352  integer(I4B), dimension(:), allocatable :: indxarr
353  real(DP), dimension(:), allocatable :: tarr
354  ! -- functions
355  ! -- code
356  !
357  ! -- allocate tarr and create idxarr
358  allocate (tarr(size(a)))
359  allocate (indxarr(size(a)))
360  !
361  ! -- fill tarr with a and create index
362  do n = 1, size(a)
363  tarr(n) = a(n)
364  indxarr(n) = n
365  end do
366  !
367  ! -- sort a in increasing order
368  call qsort(indxarr, tarr, reverse=.true.)
369  !
370  ! -- determine the number of unique values
371  count = 1
372  do n = 2, size(tarr)
373  if (tarr(n) > tarr(n - 1)) count = count + 1
374  end do
375  !
376  ! -- allocate b for unique values
377  if (allocated(b)) then
378  deallocate (b)
379  end if
380  allocate (b(count))
381  !
382  ! -- fill b with unique values
383  b(1) = tarr(1)
384  count = 1
385  do n = 2, size(a)
386  if (tarr(n) > b(count)) then
387  count = count + 1
388  b(count) = tarr(n)
389  end if
390  end do
391  !
392  ! -- allocate tarr and create idxarr
393  deallocate (tarr)
394  deallocate (indxarr)
395  !
396  ! -- return
397  return

◆ unique_values_int1d()

subroutine sortmodule::unique_values::unique_values_int1d ( integer(i4b), dimension(:), intent(in), allocatable  a,
integer(i4b), dimension(:), intent(inout), allocatable  b 
)
private

Definition at line 290 of file sort.f90.

291  ! - dummy arguments
292  integer(I4B), dimension(:), allocatable, intent(in) :: a
293  integer(I4B), dimension(:), allocatable, intent(inout) :: b
294  ! -- local variables
295  integer(I4B) :: count
296  integer(I4B) :: n
297  integer(I4B), dimension(:), allocatable :: indxarr
298  integer(I4B), dimension(:), allocatable :: tarr
299  ! -- functions
300  ! -- code
301  !
302  ! -- allocate tarr and create idxarr
303  allocate (tarr(size(a)))
304  allocate (indxarr(size(a)))
305  !
306  ! -- fill tarr with a and create index
307  do n = 1, size(a)
308  tarr(n) = a(n)
309  indxarr(n) = n
310  end do
311  !
312  ! -- sort a in increasing order
313  call qsort(indxarr, tarr, reverse=.true.)
314  !
315  ! -- determine the number of unique values
316  count = 1
317  do n = 2, size(tarr)
318  if (tarr(n) > tarr(n - 1)) count = count + 1
319  end do
320  !
321  ! -- allocate b for unique values
322  if (allocated(b)) then
323  deallocate (b)
324  end if
325  allocate (b(count))
326  !
327  ! -- fill b with unique values
328  b(1) = tarr(1)
329  count = 1
330  do n = 2, size(a)
331  if (tarr(n) > b(count)) then
332  count = count + 1
333  b(count) = tarr(n)
334  end if
335  end do
336  !
337  ! -- allocate tarr and create idxarr
338  deallocate (tarr)
339  deallocate (indxarr)
340  !
341  ! -- return
342  return

The documentation for this interface was generated from the following file: