CCTK_ImpFromVarI sometimes returns the thorn name

Create issue
Issue #1825 closed
Steven R. Brandt created an issue

I added the following debug code to one of my routines

  int n = CCTK_NumVars();
  for(int v=0; v < n; ++v) {
    void *data = CCTK_VarDataPtrI(cctkGH,0,v);
    if(data == 0) continue;
    std::string imp = CCTK_ImpFromVarI(v);
    std::cout << "DEBUG: " << imp << "::" << CCTK_VarName(v) << std::endl;
  }

I get the following correct output from CartGrid3D DEBUG: GRID::x DEBUG: GRID::y DEBUG: GRID::z DEBUG: GRID::r

However, I see this output from CarpetReduce DEBUG: CARPETREDUCE::weight DEBUG: CARPETREDUCE::excised_cells

And I expected to see "REDUCE::weight"

Keyword:

Comments (6)

  1. Frank Löffler
    • removed comment

    In the code I see:

      if (groupscope == CCTK_PUBLIC || groupscope == CCTK_PROTECTED)
      {
        group = CCTKi_SetupGroup (imp, gname,
                                  n_basevars * vectorlength, vectorlength);
      }
      else if (groupscope == CCTK_PRIVATE)
      {
        group = CCTKi_SetupGroup (thorn, gname,
                                  n_basevars * vectorlength, vectorlength);
      }
    

    In short: for private variable groups, the implementation name is set to be the thorn name. This looks odd, but seems to be intentional.

    It can also be found in the manual: The group name should be the given in its fully qualified form, that is \code{<implementation>::<group>} for a public or protected group, and \code{<thornname>::<group>} for a private group.

    It probably should be mentioned in the docu for CCTK_ImpFromVarI as well. Anyone disagrees?

  2. Frank Löffler
    • removed comment

    Replying to [comment:2 rhaas]:

    Manual updates are always welcome.

    Of course. My question was more towards the idea of the function. From the name I would assume I do get the implementation, always, which doesn't seem to be the case. We could just add a note to the docu and go on, of course.

  3. Roland Haas
    • removed comment

    I think we should just add a note to the docu and go on. The point of the flesh code seems to be that there really is no "implementation" for a private variable since other thorns providing the same implementation would not necessarily have to posses the same private variable but have to possess the same public variables.

    Just to say both yes and no: this is not the first time that users were confused about "implementation" vs "thorn" for private variables or parameters.

  4. Log in to comment