LSUThorns/Vectors: Update Kranc-specific code

Create issue
Issue #681 closed
Erik Schnetter created an issue

Keyword:

Comments (11)

  1. Ian Hinder
    • removed comment

    I don't quite understand the undefinition of E. If the symbol is used elsewhere with a different meaning, how does that interact with Kranc? Could you elaborate?

  2. Erik Schnetter reporter
    • removed comment
    1. define does not have name scopes. If E is defined, we assume it comes from Kranc, and redefine it to its proper value with vectorisation (i.e. with ToReal). If it is not defined, then we don't define it here either.

    If we #define E here unconditionally, and some code tries to use it as a variable/type name, then this will fail. This would insert the identifier E into all source code, even those not using Kranc.

  3. Ian Hinder
    • removed comment

    OK I see. Would it make sense to change the conditional to #ifdef KRANC_C so that you can be sure you are only affecting Kranc thorns? It might be that other header files also define E for their own purposes. For Kranc-generated thorns, we can be fairly sure that this is not the case.

    Now that I think about it some more, why is this replacement handled here by macros? Wouldn't it make more sense to have E -> ToReal[E] in Kranc when vectorisation is enabled (and similarly for Pi)? Then Vectors would not need to know about a Kranc-specific symbol, and Kranc would be treating these constants just like it treats parameters (for example).

  4. Erik Schnetter reporter
    • removed comment

    Yes, using KRANC_C would be better.

    Yes, doing this in Kranc would also work.

  5. Barry Wardell
    • removed comment

    So the suggestion is to have something like to two patches I have just attached (one for Vectors, and the other for Kranc)?

  6. Erik Schnetter reporter
    • removed comment

    Yes, similar to these patches.

    I plan to commit my new version of the patch (without your patches) later today, and you could apply them then.

  7. Log in to comment