Added a sample for testing the Fortran interface

This commit is contained in:
jpekkila
2020-06-25 06:35:13 +03:00
parent fbb8d7c7c6
commit c44c3d02b4
2 changed files with 27 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
enable_language(Fortran)
add_executable(fortrantest main.f90)
target_link_libraries(fortrantest astaroth_core)

View File

@@ -0,0 +1,23 @@
program pc
use, intrinsic :: iso_c_binding
implicit none
include "astaroth.f90"
type(AcMeshInfo) :: info
type(c_ptr) :: device
print *, "Num int params"
print *, AC_NUM_INT_PARAMS
! Setup config
info%int_params(AC_nx + 1) = 128
info%int_params(AC_ny + 1) = 128
info%int_params(AC_nz + 1) = 128
call acupdatebuiltinparams(info)
call acdevicecreate(0, info, device)
call acdeviceprintinfo(device)
call acdevicedestroy(device)
end program