Skip to content

Instantly share code, notes, and snippets.

@astrofrog
Created September 28, 2016 17:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save astrofrog/47ee268a8e71dc6760ec3e0e1b4beca7 to your computer and use it in GitHub Desktop.
Save astrofrog/47ee268a8e71dc6760ec3e0e1b4beca7 to your computer and use it in GitHub Desktop.
module core_lib
use lib_version
end module core_lib
module grid_geometry_specific
use core_lib
use type_photon
use type_grid_cell
use type_grid
implicit none
save
type(grid_cell) :: cell
end module grid_geometry_specific
module lib_version
type version
character(len=10) :: string
end type version
interface operator(==)
module procedure equal
end interface operator(==)
contains
logical function equal(a, b)
implicit none
type(version),intent(in) :: a, b
equal = a%string == b%string
end function equal
end module lib_version
#!/bin/bash
ifort lib_version.f90 core_lib.f90 type_grid_cartesian_3d.f90 type_cell_id_3d.f90 grid_geometry_cartesian_3d.f90 test.f90
program test
end program test
module type_grid_cell
use type_grid
implicit none
private
public :: grid_cell
type grid_cell
integer :: i1
end type grid_cell
public :: operator(.eq.)
interface operator(.eq.)
module procedure equal
end interface operator(.eq.)
contains
logical function equal(a,b)
implicit none
type(grid_cell), intent(in) :: a,b
equal = a%i1 == b%i1
end function equal
end module type_grid_cell
module type_grid
use core_lib
implicit none
save
private
end module type_grid
module type_photon
use core_lib
use type_grid_cell
implicit none
save
private
public :: photon
type photon
type(grid_cell) :: icell
end type photon
end module type_photon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment