Cactus ParameterGetXXX functions return values for non-active thorns

Issue #1343 new
Roland Haas created an issue

using eg. CCTK_ParameterValString it is possible to access parameters of non-active thorns, eg. the line in CarpetIOHDF5/src/Input.cc lines 280ff

  char *buffer = CCTK_ParameterValString ("refinement_levels",
                                          "CarpetRegrid");
  assert (buffer);
  CCTK_VInfo (CCTK_THORNSTRING, "Using %i reflevels from checkpoint file. "
              "Ignoring value '%s' in parameter file.",
              num_reflevels, buffer);
  free (buffer);
}

char buffer[32];
snprintf (buffer, sizeof (buffer), "%d", num_reflevels);
int const retval = CCTK_ParameterSet ("refinement_levels", "CarpetRegrid",
                                      buffer);

will actually get a value (the default value it seems) and is able to steer a value of a non-active thorns.

Reading the Cactus docs this behaviour is not forbidden however I personally find it a bit confusing.

Keyword:

Comments (2)

  1. Frank Löffler
    • removed comment

    Do you suggest to let CCTK_ParameterValString return an error in case a thorn isn't active? I don't see a good reason against it, apart from, maybe:

    Going wild: what if we want to be able to activate/deactivate thorns at runtime at some point? We then probably want the ability to steer their parameters before they get activated. Of course, that's not a good argument at the moment ...

  2. Roland Haas reporter
    • removed comment

    Yes, I would propose that trying to set/query parameters that belong (only) to deactivated thorns should result in an error. To my thinking non-active thorns are not present at all and should be treated as if they were not compiled in in the first place (which is currently not the case).

  3. Log in to comment