Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
grofz committed Aug 17, 2023
2 parents cd6d8e7 + 1788443 commit 7e99d6b
Show file tree
Hide file tree
Showing 7 changed files with 588 additions and 37 deletions.
3 changes: 2 additions & 1 deletion example/user_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ module user_mod
!!
!! Contains definition of user-types and wrapper functions
use dll_mod
use dllnode_mod, only : dllnode_t, mold, DATA_KIND, dllnode_read
use dllnode_mod, only : dllnode_t, dllnode_read
use common_mod, only : mold, DATA_KIND
implicit none

integer, parameter :: MAXDIM=4
Expand Down
34 changes: 34 additions & 0 deletions src/common_mod.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module common_mod
!*
!
!
use iso_fortran_env, only : int64
implicit none
private

integer, parameter, public :: DATA_KIND=int64
!! Kind of integer array to store node data

integer(DATA_KIND), public :: mold(1)
!* This variable can be used as _mold_ argument in `transfer` function
! to cast the user type variable to the type accepted in argument of
! `dllnode_*` subroutines and functions

abstract interface
function compare_fun(adat, bdat) result(ires)
!* An user function to compare value of two nodes and return:
!
! * -1 if A is less than B;
!
! * 0 if A equals B;
!
! * +1 if A is greater than B
import :: DATA_KIND, mold
implicit none
integer(DATA_KIND), dimension(:), intent(in) :: adat, bdat
integer :: ires
end function
end interface
public compare_fun

end module common_mod
1 change: 1 addition & 0 deletions src/dll_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module dll_mod
! list
!
use dllnode_mod
use common_mod
implicit none
private

Expand Down
27 changes: 1 addition & 26 deletions src/dllnode_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,10 @@ module dllnode_mod
! will not be mixed within single list as there is no flag storing
! the actual data type.
!
use iso_fortran_env, only : int64
use common_mod, only : DATA_KIND, mold, compare_fun
implicit none
private

integer, parameter, public :: DATA_KIND=int64
!! Kind of integer array to store node data

integer(DATA_KIND), public :: mold(1)
!* This variable can be used as _mold_ argument in `transfer` function
! to cast the user type variable to the type accepted in argument of
! `dllnode_*` subroutines and functions

type, public :: dllnode_t
!! Double-linked list node
private
Expand All @@ -42,23 +34,6 @@ module dllnode_mod
module procedure dllnode_copy
end interface

abstract interface
function compare_fun(adat, bdat) result(ires)
!* An user function to compare value of two nodes and return:
!
! * -1 if A is less than B;
!
! * 0 if A equals B;
!
! * +1 if A is greater than B
import :: DATA_KIND, mold
implicit none
integer(DATA_KIND), dimension(:), intent(in) :: adat, bdat
integer :: ires
end function
end interface
public compare_fun

public dllnode_update, dllnode_read, dllnode_free
public dllnode_count, dllnode_export
public dllnode_insertinfrontof, dllnode_insertbehind
Expand Down
Loading

0 comments on commit 7e99d6b

Please sign in to comment.