#1455: CCTK_InterpGridArrays should give an error if an input variable index is -1 --------------------+------------------------------------------------------- Reporter: hinder | Owner: Type: defect | Status: new Priority: minor | Milestone: Component: Cactus | Version: development version Keywords: | --------------------+------------------------------------------------------- CCTK_InterpGridArrays takes as input a list of indices of Cactus variables to interpolate. If one of these indices is -1, no error is given, and meaningless data is returned for this variable (probably from another gridfunction). This can happen easily if you get the variable index using CCTK_VarIndex and make a spelling mistake in the variable name, and don't check the return value.
#1455: CCTK_InterpGridArrays should give an error if an input variable index is -1 ---------------------+------------------------------------------------------ Reporter: hinder | Owner: Type: defect | Status: new Priority: minor | Milestone: Component: Cactus | Version: development version Resolution: | Keywords: ---------------------+------------------------------------------------------
Comment (by eschnett):
This is a documented feature, to make it simpler to avoid interpolating grid functions that may not exist. The respective values remain uninitialized.
To be clear: the feature is that you can pass "-1" as variable index to skip the respective interpolation. The feature is not that you can pass error codes from CCTK_VarIndex to have these errors ignored.
#1455: CCTK_InterpGridArrays should give an error if an input variable index is -1 ----------------------+----------------------------------------------------- Reporter: hinder | Owner: Type: defect | Status: closed Priority: minor | Milestone: Component: Cactus | Version: development version Resolution: invalid | Keywords: ----------------------+----------------------------------------------------- Changes (by hinder):
* status: new => closed * resolution: => invalid
Comment:
I guess it was a mistake to use the same integer (-1) both as a return error code, and a code to mean "no variable" in the interpolator interface. Is there anything we can do to avoid people getting caught by this? Obviously the return value of CCTK_VarIndex should have been checked, but people don't always do this. If this is part of the documented API of both functions, and we don't want to change that, I guess we're stuck. Maybe in future we design a C++ API which has a more friendly error-reporting method than return values, such as exceptions.
#1455: CCTK_InterpGridArrays should give an error if an input variable index is -1 ---------------------+------------------------------------------------------ Reporter: hinder | Owner: Type: defect | Status: reopened Priority: minor | Milestone: Component: Cactus | Version: development version Resolution: | Keywords: ---------------------+------------------------------------------------------ Changes (by eschnett):
* status: closed => reopened * resolution: invalid =>
Comment:
Let us turn this into a feature request. The magic value to ignore a grid variable should be a preprocessor constant that we can then set to a unique value. We already make sure that all the magic values are unique in Cactus.
trac@lists.einsteintoolkit.org