[Users] bug or feature?

Ian Hinder ian.hinder at aei.mpg.de
Mon Sep 7 05:21:00 CDT 2015

On 4 Sep 2015, at 16:11, Comer Duncan <comer.duncan at gmail.com> wrote:

> I have pasted the attempted build to pastebin:  http://pastebin.com/YNDgRKNV
> There are several complaints there which may be either due to unseen errors in my Kranc script or other unrelated things.  Please let me know if you see something.  Thanks very much.

Aha!  You have a calculation with a name which is the same as the thorn name.  Kranc uses the thorn name as a C++ namespace, and calculation names as C++ function names, and these are not allowed to conflict.  This is the error you are seeing:

	• In file included from /Users/comerduncan/Cactus/arrangements/Cosmology/CT_BrillAnalytic/src/CT_BrillAnalytic.cc:14:0:
	• /Users/comerduncan/Cactus/arrangements/Cosmology/CT_BrillAnalytic/src/Kranc.hh:10:28: error: 'namespace CT_BrillAnalytic { }' redeclared as different kind of symbol
	•  namespace CT_BrillAnalytic {
	•                             ^
	• In file included from /Users/comerduncan/Cactus/configs/sim/bindings/include/CT_BrillAnalytic/cctk.h:6:0,
	•                  from /Users/comerduncan/Cactus/arrangements/Cosmology/CT_BrillAnalytic/src/CT_BrillAnalytic.cc:11:
	• /Users/comerduncan/Cactus/configs/sim/bindings/include/CT_BrillAnalytic/cctk_ScheduleFunctions.h:35:6: note: previous declaration 'void CT_BrillAnalytic(cGH*)'
	•       ^

I had never thought of this issue before; Kranc should prevent you from doing this and give an error at Kranc time.  I just created in issue for this: https://github.com/ianhinder/Kranc/issues/132.  You should just be able to change the name of the calculation from thornName to thornName <> "_<something>".

In general, I would recommend prefixing all calculation names with the thorn name, to avoid possible conflicts with other thorns.  Cactus doesn't have any thorn-based scoping mechanism, so all scheduled functions are in the same namespace.  You have some calculations called "formgk" and "gupper".  Probably they are fine, but in principle they could conflict with other thorns, so prefixing the names with the thorn name is much safer.

Ideally, I think I would like Kranc to automatically add such a prefix, but this would break backward compatibility.  Maybe Kranc should print a warning if the calculation name does not start with the thorn name (https://github.com/ianhinder/Kranc/issues/133).

Ian Hinder

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.einsteintoolkit.org/pipermail/users/attachments/20150907/2a14c24c/attachment.html 

More information about the Users mailing list