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
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
Erik
If you are trying to call this function as "Initial_Setup(CCTK_ARGUMENTS);", then this won't work. You have to call it as "Initial_Setup(CCTK_PASS_CTOC);". If you look for the string "CTOC" in the users' guide you'll find more details.
-erik
On Wed, Sep 9, 2020 at 12:44 AM Erik Rodrígo Jiménez Vázquez erjive@ciencias.unam.mx wrote:
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
Users mailing list Users@einsteintoolkit.org http://lists.einsteintoolkit.org/mailman/listinfo/users
users@lists.einsteintoolkit.org