- removed comment
GRHydro uses EOS_Omni routines without DECLARE_CCTK_FUNCTIONS
and adding DECLARE_CCTK_FUNCTIONS eg. in ConservativeToPrimitive reveals that we pass scalars to EOS_Omni routines that would expect (1 element) arrays.
Making them (pmin, epsmin, rhomin are affected) all arrays makes the code very ugly (even for GRHydro) :-).
Keyword: GRHydro
Comments (3)
-
-
reporter - removed comment
I get errors out of gfortran 4.7 and I think also out of earlier versions. Typically (ie. after adding DECLARE_CCTK_FUNCTIONS to Conservative2Primitive):
arrangements/Zelmani/GRHydro/src/GRHydro_Con2Prim.F90:111.9:
call EOS_Omni_press(GRHydro_polytrope_handle,keytemp,GRHydro_eos_rf_prec,n,& GRHydro_rho_min,xeps,xtemp,xye,pmin,keyerr,anyerr) 1 Error: Rank mismatch in argument 'rho' at (1) (rank-1 and scalar)
So you are saying:
call EOS_Pressure(eos_handle,...,/rho_min/,...,/press_min/) is legal even for cases where rho_min is only read but press_min is written to?
-
- removed comment
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).
- Log in to comment
Is the array/scalar mismatch an error? To my knowledge, the standard forbids it, but it works fine in all implementations.
Converting a scalar "rho" to an array would look like this: "(/rho/)".