<html>#2319: do not use static variables in CCTK_DECLARE_ARGUMENTS
<table style='border-spacing: 1ex 0pt; '>
<tr><td style='text-align:right'> Reporter:</td><td>Roland Haas</td></tr>
<tr><td style='text-align:right'>   Status:</td><td>open</td></tr>
<tr><td style='text-align:right'>Milestone:</td><td></td></tr>
<tr><td style='text-align:right'>  Version:</td><td></td></tr>
<tr><td style='text-align:right'>     Type:</td><td>enhancement</td></tr>
<tr><td style='text-align:right'> Priority:</td><td>minor</td></tr>
<tr><td style='text-align:right'>Component:</td><td>Cactus</td></tr>
</table>

<p>Comment (by Roland Haas):</p>
<p>No worries. I had not properly tagged the ticket anyway and this is not something to go in before  the 2020_05 release anyway.</p>
<p>The code basically already uses global variables but one per thorn*variable_it_has_access to. The global variables are the various <code>cctki_vi_CCTK_THORN_struct</code>structs. At startup time the flesh sets up the binding by initializing the variables in each struct (one per variable accessible to the thorn). Since this needs to be done in generated code (to get at the names of the global variables / structs) I cannot write a fixed function for the flesh. There is no new scheduled function, however each thorn now has one more auto-generated function <code>CactusBindingsVarIndex_${thorn}_Initialise</code> which the flesh calls these after it has called all <code>CactusBindingsVariables_${thorn}_Initialise</code> functions. The need to have a separate set of functions comes from the fact that, for public or protected variables, each thorn that inherits from an implementation providing them declares its own global variable for those inherited variables. Since an inheriting
  thorn may activate itself before the implementation it inherits from I must wait until all thorns are activated.</p>
<p>Lookup is then:</p>
<div class="codehilite language-c"><pre><span></span><span class="n">CCTK_JOIN_TOKENS</span><span class="p">(</span><span class="n">cctki_vi_</span><span class="p">,</span> <span class="n">CCTK_THORN</span><span class="p">).</span><span class="err">$</span><span class="n">varname0</span><span class="p">)</span>
</pre></div>


<p>in <a data-is-external-link="true" href="https://bitbucket.org/cactuscode/cactus/pull-requests/81/cactus-remove-static-variables-in/diff#Llib/sbin/GridFuncStuff.plT622" rel="nofollow">https://bitbucket.org/cactuscode/cactus/pull-requests/81/cactus-remove-static-variables-in/diff#Llib/sbin/GridFuncStuff.plT622</a> .</p>
<p>If I want to reduce the number of global variables, I would have to keep track of the type of each variable (PRIVATE or PUBLIC /
<p>--<br/>
Ticket URL: <a href='https://bitbucket.org/einsteintoolkit/tickets/issues/2319/do-not-use-static-variables-in'>https://bitbucket.org/einsteintoolkit/tickets/issues/2319/do-not-use-static-variables-in</a></p>
</html>