[Users] Error in a function

Roland Haas rhaas at illinois.edu
Wed Sep 9 10:01:21 CDT 2020


Hello Erik,

there is not quite enough information provided in the code fragment you
are providing to tell for sure what is going on.

Would you be able to create a dummy thorn that shows the issue, then
include a tar file of the whole thorn (including source, header, ccl
files) as an attachment to the email?

A blind guess though: I have seem strange syntax errors being caused by
missing semicolons in header files so I would double check those. You
also do not really need to (nor should you to tell the truth) declare
"void Initial_Setup(CCTK_ARGUMENTS);" in ID.h since the Cactus flesh
will automatically include prototypes like that for all scheduled
functions in the cctk_Arguments.h file it creates for your thorn.

Yours,
Roland

> Hello everybody,
> 
> I'm writing a function to set initial conditions, but I need to use an
> interative method and I need to operate over some arrays (grid functions)
> that I previously declared in the interface.ccl file.
> 
> This is an example of one of the functions that I'm currently writing.
> 
> #include "cctk.h"
> #include "cctk_Arguments.h"
> #include "cctk_Parameters.h"
> #include "ID.h"
> 
> void Initial_Setup(CCTK_ARGUMENTS)
> {
> 
>   DECLARE_CCTK_ARGUMENTS;
>   DECLARE_CCTK_PARAMETERS;
> 
>   int index;
> 
>   int i,j,k;
>   int ierr;
> 
>   for (k=0; k<cctk_lsh[2]; k++)
>     {
>       for (j=0; j<cctk_lsh[1]; j++)
>         {
>           for (i=0; i<cctk_lsh[0]; i++)
>             {
>               index = CCTK_GFINDEX3D(cctkGH,i,j,k);
> 
>               phi[index] = 1.0;
>               pi [index] = 0.0;
>             }
>         }
>     }
> 
> }
> 
> where pi and phi are the grid functions previously defined in the
> interface.ccl and the header "ID.h" is where I defined the function
> Initial_Setup
> 
> When I call the function in the main function and compile it I get
> 
> error: type name is not allowed
>     Initial_Setup(CCTK_ARGUMENTS);
> error: expression must have arithmetic type
>     Initial_Setup(CCTK_ARGUMENTS);
> 
> these errors are the same for the other functions. All these functions are
> not scheduled but the main function is. What is the problem?
> 
> Any help will be apreciated.
> 
> Erik


-- 
My email is as private as my paper mail. I therefore support encrypting
and signing email messages. Get my PGP key from http://pgp.mit.edu .
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
Url : http://lists.einsteintoolkit.org/pipermail/users/attachments/20200909/603db755/attachment.bin 


More information about the Users mailing list