Hi everyone,
I am in a situation where I want to call a function whose argument is just CCTK_ARGUMENTS from another thorn. I am aware of the following:
-- I can share functions defined between thorns through the interface.ccl of the thorns, but I do not know how to specify CCTK_ARGUMENTS in the interface file. I cannot seem to find the cctk_arguments.h header anywhere in the Cactus directory to see what the definition of this is?
-- I can call functions with argument CCTK_ARGUMENTS within the same thorn by using CCTK_PASS_CTOC.
As a current fix (copied from CTGamma code), I can write the function like
void test(CCTK_POINTER_TO_CONST _cctkGH) { const cGH* const cctkGH = _cctkGH; DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS;
}
where this argument can now be passed through the interface file and seems to do a similar thing to CCTK_ARGUMENTS.
Any help to figure out the best way to do this would be much appreciated!
Thanks,
Chris
Yes, this is the way to do it.
-erik
On Sat, May 5, 2018 at 03:30 Chris Stevens c.stevens@ru.ac.za wrote:
Hi everyone,
I am in a situation where I want to call a function whose argument is just CCTK_ARGUMENTS from another thorn. I am aware of the following:
-- I can share functions defined between thorns through the interface.ccl of the thorns, but I do not know how to specify CCTK_ARGUMENTS in the interface file. I cannot seem to find the cctk_arguments.h header anywhere in the Cactus directory to see what the definition of this is?
-- I can call functions with argument CCTK_ARGUMENTS within the same thorn by using CCTK_PASS_CTOC.
As a current fix (copied from CTGamma code), I can write the function like
void test(CCTK_POINTER_TO_CONST _cctkGH) { const cGH* const cctkGH = _cctkGH; DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS;
}
where this argument can now be passed through the interface file and seems to do a similar thing to CCTK_ARGUMENTS.
Any help to figure out the best way to do this would be much appreciated!
Thanks,
Chris
Dr Chris Stevens
Claude Leon Postdoctoral Fellow
Department of Mathematics
Rhodes University
Room 5
Ph: +27 46 603 8932
Web: www.chrisdoesmaths.com _______________________________________________ Users mailing list Users@einsteintoolkit.org http://lists.einsteintoolkit.org/mailman/listinfo/users
Hello Chris,
as Erik said this is pretty much the (only) way to do it.
Unfortunately this way is also not officially unsupported (ie it is not documented) so can stop working in the future. It will also only work for functions using C binding (not Fortran binding).
What *sometimes* works is to put the function in thorn A you want to call in a schedule.ccl group and schedule that *group* in schedule.ccl of thorn B (it needs to be a group since, at least in theory, CCTK_ARGUMENTS could differ from thorn to thorn). This only works in some circumstances though since you have to mix schedule.ccl and C code to achieve the desired result so can become quite unwieldy if there are multiple such functions or if you need to call them in many places.
Yours, Roland
Yes, this is the way to do it.
-erik
On Sat, May 5, 2018 at 03:30 Chris Stevens c.stevens@ru.ac.za wrote:
Hi everyone,
I am in a situation where I want to call a function whose argument is just CCTK_ARGUMENTS from another thorn. I am aware of the following:
-- I can share functions defined between thorns through the interface.ccl of the thorns, but I do not know how to specify CCTK_ARGUMENTS in the interface file. I cannot seem to find the cctk_arguments.h header anywhere in the Cactus directory to see what the definition of this is?
-- I can call functions with argument CCTK_ARGUMENTS within the same thorn by using CCTK_PASS_CTOC.
As a current fix (copied from CTGamma code), I can write the function like
void test(CCTK_POINTER_TO_CONST _cctkGH) { const cGH* const cctkGH = _cctkGH; DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS;
}
where this argument can now be passed through the interface file and seems to do a similar thing to CCTK_ARGUMENTS.
Any help to figure out the best way to do this would be much appreciated!
Thanks,
Chris
Dr Chris Stevens
Claude Leon Postdoctoral Fellow
Department of Mathematics
Rhodes University
Room 5
Ph: +27 46 603 8932
Web: www.chrisdoesmaths.com _______________________________________________ Users mailing list Users@einsteintoolkit.org http://lists.einsteintoolkit.org/mailman/listinfo/users
users@lists.einsteintoolkit.org