Modify

Opened 6 years ago

Last modified 6 years ago

#1343 new defect

Cactus ParameterGetXXX functions return values for non-active thorns

Reported by: Roland Haas Owned by:
Priority: optional Milestone:
Component: Cactus Version:
Keywords: Cc:

Description

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.

Attachments (0)

Change History (2)

comment:1 Changed 6 years ago by Frank Löffler

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 ...

comment:2 Changed 6 years ago by Roland Haas

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).

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
Next status will be 'review'.
as The resolution will be set.
to The owner will be changed from (none) to the specified user.
Next status will be 'confirmed'.
The owner will be changed from (none) to anonymous.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.