Skip to content

Commit

Permalink
revert fortran
Browse files Browse the repository at this point in the history
  • Loading branch information
hverhelst committed Nov 7, 2024
1 parent e2fb4d2 commit e39d6bf
Show file tree
Hide file tree
Showing 4 changed files with 505 additions and 11 deletions.
26 changes: 20 additions & 6 deletions examples/geometry_fexample.F90
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ subroutine show_basic_usage( g )
type(t_gsgeometry) :: g
!--local variables
integer(C_INT) :: nRows, nCols, out_rows, out_cols, irow, icol, icoor, ipar
type(t_gsmatrix) :: uvm, xyzm
type(t_gsmatrix) :: uvm, xyzm, dxyzm
real(C_DOUBLE), dimension(:,:), allocatable :: uv
character(len=1), parameter :: c_param(2) = (/ 'u', 'v' /)
character(len=1), parameter :: c_coor(3) = (/ 'x', 'y', 'z' /)
character(len=1), parameter :: c_param(2) = (/ 'u', 'v' /)
character(len=1), parameter :: c_coor(3) = (/ 'x', 'y', 'z' /)
character(len=5), parameter :: c_deriv(6) = (/ 'dx/du', 'dx/dv', 'dy/du', 'dy/dv', 'dz/du', 'dz/dv' /)

nRows = 2
nCols = 7
Expand All @@ -72,9 +73,11 @@ subroutine show_basic_usage( g )

! evaluate positions (x,y,z) at given parameter values

uvm = f_gsmatrix_create_rcd(nRows, nCols, uv)
xyzm = f_gsmatrix_create()
uvm = f_gsmatrix_create_rcd(nRows, nCols, uv)
xyzm = f_gsmatrix_create()
dxyzm = f_gsmatrix_create()
call f_gsFunctionSet_eval_into(G, uvm, xyzm)
call f_gsFunctionSet_deriv_into(G, uvm, dxyzm)
! call f_gsmatrix_print(xyzm)

! show output data
Expand All @@ -84,11 +87,22 @@ subroutine show_basic_usage( g )

write(*,'(3(a,i3))') 'Values: #rows =', out_rows, ', #cols =', out_cols
do irow = 1, out_rows
write(*,'(3a,10f10.3)') ' ',c_coor(irow),': ', (xyzm%data(irow,icol), icol=1,out_cols)
write(*,'(3a,10f10.3)') ' ',c_coor(irow),': ', (xyzm%data(irow,icol), icol=1,out_cols)
enddo

! show derivatives data

out_rows = f_gsmatrix_rows(dxyzm)
out_cols = f_gsmatrix_cols(dxyzm)

write(*,'(3(a,i3))') 'Derivatives: #rows =', out_rows, ', #cols =', out_cols
do irow = 1, out_rows
write(*,'(3a,10f10.3)') ' ',c_deriv(irow),': ', (dxyzm%data(irow,icol), icol=1,out_cols)
enddo

call f_gsmatrix_delete(uvm)
call f_gsmatrix_delete(xyzm)
call f_gsmatrix_delete(dxyzm)
deallocate(uv)

end subroutine show_basic_usage
Expand Down
Loading

0 comments on commit e39d6bf

Please sign in to comment.