OPTIONAL_IFACTIVE

Issue #1220 closed
Erik Schnetter created an issue

Following up on a discussion on the Cactus developers mailing list, I want to suggest a third way of indicating a desired capability. In addition to REQUIRES and OPTIONAL, I suggest OPTIONAL_IFACTIVE. This behaves like OPTIONAL, except that the capability relationship only exists if the thorn providing the capability is active.

For example, thorn GRHydro would state "OPTIONAL_IFACTIVE Carpet". This mean that, if Carpet is built into the configuration (i.e. is in the thorn list), and if Carpet is active, then GRHydro will depend on it, e.g. by calling functions in Carpet. If Carpet is not in the thorn lists, these calls will be #ifdef'd out, and if Carpet is not active, these calls will not occur.

This will make it possible to automatically activate all thorns that provide a required capability. In fact, the attached patch already implements this.

Keyword:

Comments (6)

  1. Roland Haas
    • changed status to open
    • removed comment

    This patch causes segfaults in line 961 of main/ActiveThorns.c when a thorn in ActiveThornss is not compiled into the executable.

          this_thorn = ((t_sktree *) SKTreeFindNode(thornlist, thorn))->data;
    

    needs to be replaced by the equivalent of

    t_sktree *node = SKTreeFindNode(thornlist, thorn);
    if (!node)
      continue;
    this_thorn = node->data;
    
  2. Log in to comment