#967: GRHydro uses EOS_Omni routines without DECLARE_CCTK_FUNCTIONS ------------------------------------+--------------------------------------- Reporter: rhaas | Owner: Type: defect | Status: new Priority: minor | Milestone: Component: EinsteinToolkit thorn | Version: Resolution: | Keywords: GRHydro ------------------------------------+---------------------------------------
Comment (by eschnett):
The syntax is (/rho_min/); the parentheses are necessary.
No, this is only for variables that are read. If the variables are also written, then I would recommend using pointers (or temporary arrays with copy-in and copy-out, but this is cumbersome).
{{{ subroutine call_with_array(b) integer b integer a(1) pointer (pa,a) pa = loc(b) call wantarray(a) end }}}
This defined a subroutine with a scalar argument b. The subroutine defines a pointer variable pa, pointing to an array. (No space is allocated for an array.) The pointer is set to the address of b. The pointer is dereferenced (in C parlance) by using its "other name". In C, this code corresponds to something like
{{{ int b; int[1] *pa; pa = &b; wantarray(*pa); }}}
(except that int[1] is not a type in C, so one would have to wrap it into a structure, and this would make the C version of this example more complex than necessary).