This function invokes the vectorial Lua function, which takes barycentric coordinates of an element.
Lua function defined in the script is connected to the conf handle and return the result of the function. The Lua function takes barycentric coordinate as input argument i.e fun_name(x,y,z)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | fun_ref |
Lua reference to the function to evaluate. |
||
type(flu_State), | optional | :: | conf |
lua state |
||
real(kind=rk), | intent(in) | :: | coord(n,3) |
barycentric Ids of an elements. 1st index goes over number of elements and 2nd index goes over x,y,z coordinates |
||
integer, | intent(in) | :: | n |
number of return values |
||
integer, | intent(in) | :: | ncomp |
number of components in the resulting vector |
return value
function tem_spatial_lua_vector_for_coord( fun_ref, conf, coord, n, ncomp ) & & result(res) ! -------------------------------------------------------------------- ! !> Lua reference to the function to evaluate. integer, intent(in) :: fun_ref !> number of return values integer, intent(in) :: n !> number of components in the resulting vector integer, intent(in) :: ncomp !> barycentric Ids of an elements. !! 1st index goes over number of elements and !! 2nd index goes over x,y,z coordinates real(kind=rk), intent(in) :: coord(n,3) !> lua state type(flu_State), optional :: conf !> return value real(kind=rk) :: res(n,ncomp) ! -------------------------------------------------------------------- ! type(aot_fun_type) :: fun integer :: iError(ncomp) integer :: iDir, jDir ! -------------------------------------------------------------------- ! call aot_fun_open(L=conf, fun=fun, ref=fun_ref) do iDir = 1, n do jDir = 1, 3 call aot_fun_put( L=conf, fun=fun, arg=coord(iDir,jDir) ) end do call aot_fun_do(L=conf, fun=fun, nresults=1) call aot_top_get_val(L=conf, val=res(iDir,:), ErrCode=iError) if ( any(btest(iError,aoterr_Fatal)) ) then write(logunit(0),*) "ERROR Obtaining a spactial function" write(logunit(0),*) "Probably wrong number of components returned" write(logunit(0),*) "or a scalar was return as a lua table" write(logunit(0),*) 'Expected nComp: ', nComp write(logunit(0),*) 'ErrorCodes: ', iError write(logunit(0),*) "Check return values of your Lua functions!" call tem_abort() end if end do call aot_fun_close(L=conf, fun=fun) end function tem_spatial_lua_vector_for_coord